Refactoring for immutable nodes

This commit is contained in:
Michael Schimmel
2025-11-05 13:21:17 +01:00
parent 9bd2d6f7ab
commit c0a689d2bc
13 changed files with 217 additions and 190 deletions
+3 -3
View File
@@ -85,16 +85,16 @@ end;
function TAstLowerer.VisitFunctionCall(const Node: IFunctionCallNode): IAstNode;
var
calleeIdentifier: TIdentifierNode;
calleeIdentifier: IIdentifierNode;
binaryOp: TScalar.TBinaryOp;
unaryOp: TScalar.TUnaryOp;
left, right: IAstNode;
nodeType: IStaticType;
begin
// --- Optimization: Operator Folding ---
if (Node.Callee is TIdentifierNode) then
if Node.Callee.Kind = akIdentifier then
begin
calleeIdentifier := Node.Callee as TIdentifierNode;
calleeIdentifier := Node.Callee.AsIdentifier;
// Get the type *before* replacing the node (it's an IAstTypedNode)
nodeType := Node.AsTypedNode.StaticType;