Developing State handling
This commit is contained in:
@@ -50,15 +50,20 @@ implementation
|
||||
|
||||
function TInterpreterScopeTests.Execute(const ANode: IAstNode): TDataValue;
|
||||
var
|
||||
binder: IAstBinder;
|
||||
boundNode: IAstNode;
|
||||
descriptor: IScopeDescriptor;
|
||||
runtimeScope: IExecutionScope;
|
||||
visitor: IEvaluatorVisitor;
|
||||
begin
|
||||
// Helper to encapsulate the Bind -> CreateScope -> Evaluate pattern.
|
||||
binder := TAstBinder.Create(FGlobalScope);
|
||||
boundNode := binder.Execute(ANode, descriptor);
|
||||
// The binder needs an evaluator factory to expand macros (even if there are none).
|
||||
boundNode :=
|
||||
TAstBinder.Bind(
|
||||
FGlobalScope,
|
||||
ANode,
|
||||
descriptor,
|
||||
function(const Scope: IExecutionScope): IEvaluatorVisitor begin Result := TEvaluatorVisitor.Create(Scope); end
|
||||
);
|
||||
runtimeScope := descriptor.CreateScope(FGlobalScope);
|
||||
visitor := TEvaluatorVisitor.Create(runtimeScope);
|
||||
Result := visitor.Execute(boundNode);
|
||||
|
||||
Reference in New Issue
Block a user