Resolved cyclic dependencies between environment and compiler stages

This commit is contained in:
Michael Schimmel
2025-11-23 17:55:47 +01:00
parent 7c761e86e5
commit d334ffdc73
5 changed files with 211 additions and 201 deletions
+11 -2
View File
@@ -12,8 +12,7 @@ uses
Myc.Ast.Visitor,
Myc.Ast.Scope,
Myc.Ast.Types,
Myc.Ast,
Myc.Ast.Environment;
Myc.Ast;
type
IAstMacroExpander = interface(IAstVisitor)
@@ -56,6 +55,16 @@ type
): IAstNode;
end;
IMacroRegistry = interface
{$region 'private'}
function GetParent: IMacroRegistry;
{$endregion}
procedure Define(const Node: IMacroDefinitionNode);
function Find(const Name: string): IMacroDefinitionNode;
function CreateChildRegistry: IMacroRegistry;
property Parent: IMacroRegistry read GetParent;
end;
// Handles the expansion of macro calls within the AST.
TMacroExpander = class(TAstTransformer, IAstMacroExpander)
private