From 2a5b87f45f2c743a1aaac2ad76e59e6464fc392e Mon Sep 17 00:00:00 2001 From: Brummel Date: Mon, 30 Mar 2026 14:30:07 +0200 Subject: [PATCH] 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. --- src/ast/compiler/analyzer.rs | 20 +++++++++++++++++++- src/ast/compiler/lambda_collector.rs | 24 ++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/ast/compiler/analyzer.rs b/src/ast/compiler/analyzer.rs index 2f2411e..090e6b4 100644 --- a/src/ast/compiler/analyzer.rs +++ b/src/ast/compiler/analyzer.rs @@ -369,7 +369,25 @@ impl NodeExt for NodeKind { 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(_) => {} } } } diff --git a/src/ast/compiler/lambda_collector.rs b/src/ast/compiler/lambda_collector.rs index c76f064..80222c3 100644 --- a/src/ast/compiler/lambda_collector.rs +++ b/src/ast/compiler/lambda_collector.rs @@ -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(_) => {} } } }