tamer: asg::air::expr::ExprStack: {SPair=>ObjectIndex} reachable evidence
This result in less useful debug output, but it'll be needed for using a (possibly-anonymous) template as evidence. This evidence is simply for debugging, and to require some sort of value during development to help obviate when maybe something is being done incorrectly (if no obvious value exists). DEV-13708main
parent
c1d04f1cf4
commit
8cb781ccca
|
@ -23,14 +23,14 @@
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
super::{
|
super::{
|
||||||
graph::object::{Expr, Pkg},
|
graph::object::{Expr, Object, Pkg},
|
||||||
Asg, AsgError, ObjectIndex,
|
Asg, AsgError, ObjectIndex,
|
||||||
},
|
},
|
||||||
ir::AirBindableExpr,
|
ir::AirBindableExpr,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
|
asg::ObjectKind,
|
||||||
f::Functor,
|
f::Functor,
|
||||||
fmt::{DisplayWrapper, TtQuote},
|
|
||||||
parse::prelude::*,
|
parse::prelude::*,
|
||||||
span::Span,
|
span::Span,
|
||||||
};
|
};
|
||||||
|
@ -125,7 +125,7 @@ impl ParseState for AirExprAggregate {
|
||||||
match oi_ident.bind_definition(asg, id, oi) {
|
match oi_ident.bind_definition(asg, id, oi) {
|
||||||
Ok(_) => Transition(BuildingExpr(
|
Ok(_) => Transition(BuildingExpr(
|
||||||
oi_pkg,
|
oi_pkg,
|
||||||
es.reachable_by(id),
|
es.reachable_by(oi_ident),
|
||||||
oi,
|
oi,
|
||||||
))
|
))
|
||||||
.incomplete(),
|
.incomplete(),
|
||||||
|
@ -233,16 +233,17 @@ pub enum StackEdge {
|
||||||
|
|
||||||
/// Root expression is reachable from another object.
|
/// Root expression is reachable from another object.
|
||||||
///
|
///
|
||||||
/// The associated [`SPair`] serves as _evidence_ of this assertion.
|
/// The associated [`ObjectIndex`] serves as _evidence_ of this
|
||||||
Reachable(SPair),
|
/// assertion.
|
||||||
|
Reachable(ObjectIndex<Object>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for StackEdge {
|
impl Display for StackEdge {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Dangling => write!(f, "dangling"),
|
Self::Dangling => write!(f, "dangling"),
|
||||||
Self::Reachable(ident) => {
|
Self::Reachable(oi) => {
|
||||||
write!(f, "reachable (by {})", TtQuote::wrap(ident))
|
write!(f, "reachable (by {oi})")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,10 +296,10 @@ impl ExprStack<Active> {
|
||||||
/// If not parsing the root expression
|
/// If not parsing the root expression
|
||||||
/// (if the stack is non-empty),
|
/// (if the stack is non-empty),
|
||||||
/// this returns `self` unchanged.
|
/// this returns `self` unchanged.
|
||||||
fn reachable_by(self, ident: SPair) -> Self {
|
fn reachable_by<O: ObjectKind>(self, oi: ObjectIndex<O>) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self(stack, Active(StackEdge::Dangling)) if stack.is_empty() => {
|
Self(stack, Active(StackEdge::Dangling)) if stack.is_empty() => {
|
||||||
Self(stack, Active(StackEdge::Reachable(ident)))
|
Self(stack, Active(StackEdge::Reachable(oi.widen())))
|
||||||
}
|
}
|
||||||
_ => self,
|
_ => self,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue