AST list refactoring

This commit is contained in:
Michael Schimmel
2026-01-04 22:41:44 +01:00
parent 2a7e6626ad
commit 242ec9a56e
27 changed files with 815 additions and 1076 deletions
+8 -8
View File
@@ -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;