Expand description
Defines the structure of a stack graph.
This module contains all of the types that you need to define the structure of a particular stack graph.
The stack graph as a whole lives in an instance of StackGraph
. This type contains
several Arena
s, which are used to manage the life cycle of the data instances that
comprise the stack graph. You cannot delete anything from the stack graph; all of its contents
are dropped in a single operation when the graph itself is dropped.
There are several different kinds of node that can appear in a stack graph. As we search for a path representing a name binding, each kind of node has different rules for how it interacts with the symbol and scope stacks:
- the singleton root node, which allows name binding paths to cross between files
- scope nodes, which define the name binding structure within a single file
- push symbol and push scoped symbol nodes, which push onto the symbol stack new things for us to look for
- pop symbol and pop scoped symbol nodes, which pop things off the symbol stack once they’ve been found
- drop scopes and jump to scope nodes, which manipulate the scope stack
All nodes except for the singleton root node and jump to scope node belong to files.
Nodes are connected via edges.
Structs§
- Debug
Entry - A debug entry consisting of a string key-value air of strings.
- Debug
Info - Contains debug info about a stack graph node as key-value pairs of strings.
- Drop
Scopes Node - Removes everything from the current scope stack.
- Edge
- Connects two nodes in a stack graph.
- File
- A source file that we have extracted stack graph data from.
- Interned
String - Arbitrary string content associated with some part of a stack graph.
- Jump
ToNode - The singleton “jump to” node, which allows a name binding path to jump back to another part of the graph.
- NodeID
- Uniquely identifies a node in a stack graph.
- PopScoped
Symbol Node - Pops a scoped symbol from the symbol stack. If the top of the symbol stack doesn’t match the requested symbol, or if the top of the symbol stack doesn’t have an attached scope list, then the path is not allowed to enter this node.
- PopSymbol
Node - Pops a symbol from the symbol stack. If the top of the symbol stack doesn’t match the requested symbol, then the path is not allowed to enter this node.
- Push
Scoped Symbol Node - Pushes a scoped symbol onto the symbol stack.
- Push
Symbol Node - Pushes a symbol onto the symbol stack.
- Root
Node - The singleton root node, which allows a name binding path to cross between files.
- Scope
Node - A node that adds structure to the graph. If the node is exported, it can be referred to on the scope stack, which allows “jump to” nodes in any other part of the graph can jump back here.
- Source
Info - Contains information about a range of code in a source code file.
- Stack
Graph - Contains all of the nodes and edges that make up a stack graph.
- Symbol
- A name that we are trying to resolve using stack graphs.