Making AST node inmmutable - WIP

This commit is contained in:
Michael Schimmel
2025-11-04 20:12:12 +01:00
parent 48ccb23060
commit d82a75aba6
6 changed files with 123 additions and 56 deletions
+4 -4
View File
@@ -137,7 +137,7 @@ end;
function TTypeChecker.VisitVariableDeclaration(const Node: IVariableDeclarationNode): IAstNode;
var
initType: IStaticType;
boundIdent: TIdentifierNode;
boundIdent: IIdentifierNode;
adr: TResolvedAddress;
begin
// 1. Visit children first (Identifier is leaf, Initializer is traversed)
@@ -149,9 +149,9 @@ begin
else
initType := TTypes.Void;
// 3. Get the address from the bound identifier.
boundIdent := (Node.Identifier as TIdentifierNode);
adr := boundIdent.Address;
// 3. Get the address from the bound identifier (SAFE CAST)
boundIdent := Node.Identifier;
adr := boundIdent.AsBoundIdentifierNode.Address;
// 4. Update the type in the scope descriptor (which was set to Unknown by the binder).
FCurrentDescriptor.UpdateType(adr.SlotIndex, initType);