Resolved cyclic dependencies between environment and compiler stages
This commit is contained in:
@@ -39,24 +39,15 @@ type
|
||||
procedure SetExecutionStrategy(const AStrategy: IExecutionStrategy);
|
||||
|
||||
function ExpandMacros(const Node: IAstNode): IAstNode;
|
||||
|
||||
// Updated: Returns Layout, not Descriptor. Performs Binding AND TypeChecking.
|
||||
function Bind(const Node: IAstNode; out Layout: IScopeLayout; const AArgTypes: TArray<IStaticType> = []): IAstNode;
|
||||
|
||||
// Updated: Removed Descriptor parameter.
|
||||
function Specialize(const Node: IAstNode): IAstNode;
|
||||
|
||||
function Compile(
|
||||
const ANode: IAstNode;
|
||||
const Params: TArray<IIdentifierNode> = [];
|
||||
const AArgTypes: TArray<IStaticType> = []
|
||||
): TCompiledFunction; overload;
|
||||
|
||||
function Compile(const Node: IFunctionDefinition; const ArgTypes: TArray<IStaticType> = []): TCompiledFunction; overload;
|
||||
function Compile(const Node: IFunctionDefinition; const ArgTypes: TArray<IStaticType> = []): TCompiledFunction;
|
||||
|
||||
function CreateEnvironment: IEnvironment;
|
||||
|
||||
property RootScope: IExecutionScope read GetRootScope;
|
||||
|
||||
property MacroRegistry: IMacroRegistry read GetMacroRegistry;
|
||||
property MonomorphCache: IMonomorphCache read GetMonomorphCache;
|
||||
property FunctionRegistry: IFunctionDefinitionRegistry read GetFunctionRegistry;
|
||||
@@ -174,11 +165,6 @@ type
|
||||
function Bind(const Node: IAstNode; out Layout: IScopeLayout; const ArgTypes: TArray<IStaticType>): IAstNode;
|
||||
function Specialize(const Node: IAstNode): IAstNode;
|
||||
|
||||
function Compile(
|
||||
const Node: IAstNode;
|
||||
const Params: TArray<IIdentifierNode>;
|
||||
const ArgTypes: TArray<IStaticType>
|
||||
): TCompiledFunction; overload;
|
||||
function Compile(const Node: IFunctionDefinition; const ArgTypes: TArray<IStaticType>): TCompiledFunction; overload;
|
||||
end;
|
||||
|
||||
@@ -215,7 +201,7 @@ function TAstEnvironment.Compile(
|
||||
const ArgTypes: TArray<IStaticType> = []
|
||||
): TCompiledFunction;
|
||||
begin
|
||||
Result := FEnvironment.Compile(Node, Params, ArgTypes);
|
||||
Result := FEnvironment.Compile(TAst.LambdaExpr(Params, Node), ArgTypes);
|
||||
end;
|
||||
|
||||
function TAstEnvironment.Compile(const Node: IFunctionDefinition; const ArgTypes: TArray<IStaticType> = []): TCompiledFunction;
|
||||
@@ -361,16 +347,6 @@ begin
|
||||
Result := TEnvironment.Create(TAst.CreateScope(FRootScope), TMacroRegistry.Create(FMacroRegistry), FExecutionStrategy);
|
||||
end;
|
||||
|
||||
function TEnvironment.Compile(
|
||||
const Node: IAstNode;
|
||||
const Params: TArray<IIdentifierNode>;
|
||||
const ArgTypes: TArray<IStaticType>
|
||||
): TCompiledFunction;
|
||||
begin
|
||||
// Wrap in Lambda to create an isolatable compilation unit (scope)
|
||||
Result := Compile(TAst.LambdaExpr(Params, Node).AsLambdaExpression, ArgTypes);
|
||||
end;
|
||||
|
||||
function TEnvironment.Compile(const Node: IFunctionDefinition; const ArgTypes: TArray<IStaticType>): TCompiledFunction;
|
||||
var
|
||||
layout: IScopeLayout;
|
||||
|
||||
Reference in New Issue
Block a user