Fixed macro expansion

This commit is contained in:
Michael Schimmel
2025-11-05 10:03:27 +01:00
parent 980919525b
commit edd3e83377
4 changed files with 7 additions and 105 deletions
+7 -5
View File
@@ -503,12 +503,14 @@ var
N: TMacroExpansionNode;
begin
N := (Node as TMacroExpansionNode);
// Visit original call parts
N.Callee := Accept(N.Callee);
N.Arguments := AcceptNodes(N.Arguments);
// Visit expanded body
// ONLY visit the expanded body, as this is the "real" AST node.
N.ExpandedBody := Accept(N.ExpandedBody);
Result := Node;
// Callee and Arguments are metadata for the visualizer and must NOT be visited
// by subsequent phases (Binder, TypeChecker, etc.).
Result := Node; // Return the (mutated) wrapper
end;
function TAstTransformer.VisitBlockExpression(const Node: IBlockExpressionNode): IAstNode;