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:
@@ -369,7 +369,25 @@ impl NodeExt for NodeKind<TypedPhase> {
|
||||
NodeKind::Expansion { 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(_) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,8 +104,28 @@ where
|
||||
NodeKind::Expansion { expanded, .. } => {
|
||||
self.visit(expanded);
|
||||
}
|
||||
|
||||
_ => {} // Leaf nodes
|
||||
NodeKind::GetField { rec, .. } => {
|
||||
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(_) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user