1st full macro expander
This commit is contained in:
@@ -33,6 +33,7 @@ uses
|
||||
Myc.Ast.Binding,
|
||||
Myc.Ast.RTL,
|
||||
Myc.Ast.Script,
|
||||
Myc.Ast.MacroExpander,
|
||||
FMX.Layouts,
|
||||
FMX.Objects,
|
||||
Myc.Ast.Debugger,
|
||||
@@ -214,8 +215,24 @@ var
|
||||
scriptScope: IExecutionScope;
|
||||
visitor: IEvaluatorVisitor;
|
||||
begin
|
||||
var macroExpander :=
|
||||
TMacroExpander.Create(
|
||||
function(const ANode: IAstNode): TDataValue
|
||||
begin
|
||||
var binder := TAstBinder.Create(AParentScope) as IAstBinder;
|
||||
|
||||
var descriptor: IScopeDescriptor;
|
||||
var boundAst := binder.Execute(ANode, descriptor);
|
||||
|
||||
var evalScope := descriptor.CreateScope(AParentScope);
|
||||
var evaluator := CreateEvaluator(evalScope);
|
||||
|
||||
Result := evaluator.Execute(boundAst);
|
||||
end)
|
||||
as IMacroExpander;
|
||||
|
||||
binder := TAstBinder.Create(AParentScope);
|
||||
FCurrAst := binder.Execute(ANode, FCurrDesc);
|
||||
FCurrAst := binder.Execute(macroExpander.Execute(ANode), FCurrDesc);
|
||||
|
||||
scriptScope := FCurrDesc.CreateScope(AParentScope);
|
||||
visitor := CreateEvaluator(scriptScope);
|
||||
|
||||
Reference in New Issue
Block a user