Module stack_graphs::graph [−][src]
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
- exported and internal scopes, 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
DropScopesNode | Removes everything from the current scope stack. |
Edge | Connects two nodes in a stack graph. |
ExportedScopeNode | A node that can be referred to on the scope stack, which allows “jump to” nodes in any other part of the graph can jump back here. |
File | A source file that we have extracted stack graph data from. |
InternalScopeNode | A node internal to a single file. This node has no effect on the symbol or scope stacks; it’s just used to add structure to the graph. |
JumpToNode | 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. |
PopScopedSymbolNode | 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. |
PopSymbolNode | 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. |
PushScopedSymbolNode | Pushes a scoped symbol onto the symbol stack. |
PushSymbolNode | Pushes a symbol onto the symbol stack. |
RootNode | The singleton root node, which allows a name binding path to cross between files. |
StackGraph | 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. |
UnknownNode | A placeholder for a node that you know needs to exist, but don’t yet know what kind of node it
will be. Before you can use the graph, you must use |
Enums
Node | A node in a stack graph. |