Add handling for new node kinds in visitors

The `analyzer.rs` and `lambda_collector.rs` files have been updated to
correctly traverse and process new node kinds in the Abstract Syntax
Tree (AST). This ensures that these new node types are properly included
in the analysis and lambda collection phases of the compiler.
This commit is contained in:
2026-03-30 14:30:07 +02:00
parent 90df8bf788
commit 2a5b87f45f
2 changed files with 41 additions and 3 deletions
+19 -1
View File
@@ -369,7 +369,25 @@ impl NodeExt for NodeKind<TypedPhase> {
NodeKind::Expansion { expanded, .. } => { NodeKind::Expansion { expanded, .. } => {
f(expanded); f(expanded);
} }
_ => {} NodeKind::Again { args } => {
f(args);
}
NodeKind::MacroDecl { params, body, .. } => {
f(params);
f(body);
}
NodeKind::Template(inner)
| NodeKind::Placeholder(inner)
| NodeKind::Splice(inner) => {
f(inner);
}
// Leaf nodes — no children to visit.
NodeKind::Nop
| NodeKind::Constant(_)
| NodeKind::Identifier { .. }
| NodeKind::FieldAccessor(_)
| NodeKind::Error
| NodeKind::Extension(_) => {}
} }
} }
} }
+22 -2
View File
@@ -104,8 +104,28 @@ where
NodeKind::Expansion { expanded, .. } => { NodeKind::Expansion { expanded, .. } => {
self.visit(expanded); self.visit(expanded);
} }
NodeKind::GetField { rec, .. } => {
_ => {} // Leaf nodes self.visit(rec);
}
NodeKind::Again { args } => {
self.visit(args);
}
NodeKind::MacroDecl { params, body, .. } => {
self.visit(params);
self.visit(body);
}
NodeKind::Template(inner)
| NodeKind::Placeholder(inner)
| NodeKind::Splice(inner) => {
self.visit(inner);
}
// Leaf nodes — no children to visit.
NodeKind::Nop
| NodeKind::Constant(_)
| NodeKind::Identifier { .. }
| NodeKind::FieldAccessor(_)
| NodeKind::Error
| NodeKind::Extension(_) => {}
} }
} }
} }