Expand description
Tree traversal utilities for AIRL IR nodes.
Since nodes are inline trees (not graph-referenced), these utilities provide the building blocks for finding, replacing, and transforming nodes by their NodeId.
Functionsยง
- collect_
node_ ids - Collect all NodeIds in a tree.
- find_
containing_ function - Find which function contains a node with the given ID.
- find_
node - Find a node by ID in a tree, returning a reference to it.
- functions_
containing_ node - Collect all function IDs that contain a given node ID.
- node_
contains_ id - Check if a node tree contains a node with the given ID.
- rename_
in_ tree - Rename all occurrences of a symbol in a node tree. Renames: variable names in Param/Let, call targets in Call.
- replace_
node_ in_ tree - Replace a node by ID in a tree, returning a new tree with the replacement. Returns None if the target was not found.