AST list refactoring
This commit is contained in:
@@ -133,7 +133,7 @@ var
|
||||
C: IFunctionCallNode;
|
||||
newCall: IFunctionCallNode;
|
||||
newCallee: IAstNode;
|
||||
newArgsList: IArgumentList;
|
||||
newArgs: ITupleNode;
|
||||
i: Integer;
|
||||
calleeIdent: IIdentifierNode;
|
||||
argTypes: TArray<IStaticType>;
|
||||
@@ -149,7 +149,7 @@ begin
|
||||
// inherited VisitFunctionCall returns an IAstNode (which is a new IFunctionCallNode if changed)
|
||||
newCall := inherited VisitFunctionCall(Node).AsFunctionCall;
|
||||
newCallee := newCall.Callee;
|
||||
newArgsList := newCall.Arguments;
|
||||
newArgs := newCall.Arguments;
|
||||
|
||||
// 2. Check if this call is a candidate for specialization
|
||||
if newCallee.Kind <> akIdentifier then
|
||||
@@ -163,10 +163,10 @@ begin
|
||||
|
||||
// 3. Check if all argument types are statically known
|
||||
allTypesKnown := True;
|
||||
SetLength(argTypes, newArgsList.Count);
|
||||
for i := 0 to newArgsList.Count - 1 do
|
||||
SetLength(argTypes, newArgs.Count);
|
||||
for i := 0 to newArgs.Count - 1 do
|
||||
begin
|
||||
argTypes[i] := newArgsList[i].AsTypedNode.StaticType;
|
||||
argTypes[i] := newArgs.Items[i].AsTypedNode.StaticType;
|
||||
if argTypes[i].Kind = stUnknown then
|
||||
begin
|
||||
allTypesKnown := False;
|
||||
@@ -192,7 +192,7 @@ begin
|
||||
TAst.FunctionCall(
|
||||
Node.Identity,
|
||||
newCallee,
|
||||
newArgsList,
|
||||
newArgs,
|
||||
specializedMethod.ReturnType,
|
||||
C.IsTailCall,
|
||||
specializedMethod.Target,
|
||||
@@ -212,7 +212,7 @@ begin
|
||||
TAst.FunctionCall(
|
||||
Node.Identity,
|
||||
newCallee,
|
||||
newArgsList,
|
||||
newArgs,
|
||||
specializedMethod.ReturnType,
|
||||
C.IsTailCall,
|
||||
specializedMethod.Target,
|
||||
@@ -253,7 +253,7 @@ begin
|
||||
FMonomorphCache.Add(key, specializedMethod);
|
||||
|
||||
// 6c. Return the new node
|
||||
Result := TAst.FunctionCall(Node.Identity, newCallee, newArgsList, returnType, C.IsTailCall, compiled.Func, compiled.IsPure);
|
||||
Result := TAst.FunctionCall(Node.Identity, newCallee, newArgs, returnType, C.IsTailCall, compiled.Func, compiled.IsPure);
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user