tame/tamer/src/asg/graph/object
Mike Gerwitz 94bbc2d725 tamer: asg::air: Root AirIdent operations using AirAggregateCtx
This is the culmination of a great deal of work over the past few
weeks.  Indeed, this change has been prototyped a number of different ways
and has lived in a stash of mine, in one form or another, for a few weeks.

This is not done just yet---I have to finish moving the index out of Asg,
and then clean up a little bit more---but this is a significant
simplification of the system.  It was very difficult to reason about prior
approaches, and this finally moves toward doing something that I wasn't sure
if I'd be able to do successfully: formalize scope using AirAggregate's
stack and encapsulate indexing as something that is _supplemental_ to the
graph, rather than an integral component of it.

This _does not yet_ index the AirIdent operation on the package itself
because the active state is not part of the stack; that is one of the
remaining changes I still have stashed.  It will be needed shortly for
package imports.

This rationale will have to appear in docs, which I intend to write soon,
but: this means that `Asg` contains _resolved_ data and itself has no
concept of scope.  The state of the ASG immediately after parsing _can_ be
used to derive what the scope _must_ be (and indeed that's what
`asg::air::test::scope::derive_scopes_from_asg` does), but once we start
performing optimizations, that will no longer be true in all cases.

This means that lexical scope is a property of parsing, which, well, seems
kind of obvious from its name.  But the awkwardness was that, if we consider
scope to be purely a parse-time thing---used only to construct the
relationships on the graph and then be discarded---then how do we query for
information on the graph?  We'd have to walk the graph in search of an
identifier, which is slow.

But when do we need to do such a thing?  For tests, it doesn't matter if
it's a little bit slow, and the graphs aren't all that large.  And for
operations like template expansion and optimizations, if they need access to
a particular index, then we'll be sure to generate or provide the
appropriate one.  If we need a central database of identifiers for tooling
in the future, we'll create one then.  No general-purpose identifier lookup
_is_ actually needed.

And with that, `Asg::lookup_or_missing` is removed.  It has been around
since the beginning of the ASG, when the linker was just a prototype, so
it's the end of TAMER's early era as I was trying to discover exactly what I
wanted the ASG to represent.

DEV-13162
2023-05-17 12:23:36 -04:00
..
ident Copyright year and name update 2023-01-20 23:37:30 -05:00
pkg tamer: asg: Integrate package CanonicalName 2023-05-05 10:26:58 -04:00
doc.rs tamer: asg: Basic `Doc::Text` support 2023-04-12 12:04:12 -04:00
expr.rs tamer: asg::air: Index package identifiers on `Pkg` rather than `Root` 2023-04-19 12:40:34 -04:00
ident.rs tamer: asg::air: Root AirIdent operations using AirAggregateCtx 2023-05-17 12:23:36 -04:00
meta.rs tamer: asg::graph::object::prelude: New module to reduce imports 2023-04-07 09:56:50 -04:00
pkg.rs tamer: asg: Restrict index-related operations to AIR 2023-05-17 11:37:03 -04:00
rel.rs tamer: asg: Restrict index-related operations to AIR 2023-05-17 11:37:03 -04:00
root.rs tamer: asg: Restrict index-related operations to AIR 2023-05-17 11:37:03 -04:00
tpl.rs tamer: NIR->xmli: Support template/@desc 2023-04-12 15:53:16 -04:00