Skip to main content

Module node

Module node 

Source

Structs§

NormalizationContext
Tracks identifier-to-placeholder mappings during normalization.
NormalizedNode
A normalized AST node. Uses a data-driven { kind, children } representation instead of a large enum with differently-shaped variants. This allows generic traversal algorithms (count_nodes, reindex, count_matching, extract) to work without exhaustive matching on every variant.

Enums§

BinOpKind
Binary operators.
LiteralKind
Kinds of literals — preserves type but erases value.
NodeKind
The kind of a normalized AST node. Carries only non-child data (operator kinds, literal kinds, placeholder indices, mutability flags, macro names).
PlaceholderKind
Kinds of placeholders — what the original identifier referred to.
UnOpKind
Unary operators.

Functions§

count_nodes
Count the number of nodes in a normalized tree. None sentinel nodes are not counted.
reindex_placeholders
Re-index all placeholders in a sub-tree so that indices start from 0 per kind, assigned by first-occurrence depth-first order. This allows comparing sub-trees extracted from different function contexts.