Making AST node inmmutable - WIP
This commit is contained in:
@@ -234,7 +234,7 @@ begin
|
||||
for i := 0 to High(ArgValues) do
|
||||
begin
|
||||
// Parameters in a bound lambda must be bound identifiers.
|
||||
adr.SlotIndex := (params[i] as TIdentifierNode).Address.SlotIndex; // Changed
|
||||
adr.SlotIndex := params[i].AsBoundIdentifierNode.Address.SlotIndex; // Changed
|
||||
lambdaScope[adr] := ArgValues[i];
|
||||
end;
|
||||
|
||||
@@ -334,7 +334,7 @@ var
|
||||
itemValue, lookbackValue, seriesVar: TDataValue;
|
||||
lookback: Int64;
|
||||
begin
|
||||
seriesVar := FScope[(Node.Series as TIdentifierNode).Address]; // Changed
|
||||
seriesVar := FScope[Node.Series.AsBoundIdentifierNode.Address]; // Changed
|
||||
itemValue := Node.Value.Accept(Self);
|
||||
lookback := -1;
|
||||
|
||||
@@ -368,7 +368,7 @@ begin
|
||||
// Evaluate the new value.
|
||||
Result := Node.Value.Accept(Self);
|
||||
// Assign it. The scope's SetValues implementation now handles boxing correctly.
|
||||
FScope[(Node.Identifier as TIdentifierNode).Address] := Result; // Changed
|
||||
FScope[Node.Identifier.AsBoundIdentifierNode.Address] := Result; // Changed
|
||||
end;
|
||||
|
||||
function TEvaluatorVisitor.VisitConstant(const Node: IConstantNode): TDataValue;
|
||||
@@ -405,7 +405,7 @@ end;
|
||||
function TEvaluatorVisitor.VisitIdentifier(const Node: IIdentifierNode): TDataValue;
|
||||
begin
|
||||
// The scope's GetValues implementation now handles unboxing automatically.
|
||||
Result := FScope[(Node as TIdentifierNode).Address]; // Changed
|
||||
Result := FScope[Node.AsBoundIdentifierNode.Address]; // Changed
|
||||
end;
|
||||
|
||||
function TEvaluatorVisitor.VisitIndexer(const Node: IIndexerNode): TDataValue;
|
||||
@@ -548,8 +548,8 @@ begin
|
||||
Result := TDataValue.Void;
|
||||
|
||||
// After binding, all declaration nodes are TVariableDeclarationNode
|
||||
boundNode := Node as TVariableDeclarationNode; // Changed
|
||||
address := (boundNode.Identifier as TIdentifierNode).Address; // Changed
|
||||
boundNode := Node as TVariableDeclarationNode;
|
||||
address := boundNode.Identifier.AsBoundIdentifierNode.Address;
|
||||
|
||||
// Check the IsBoxed flag set by the binder.
|
||||
if boundNode.IsBoxed then
|
||||
@@ -641,7 +641,7 @@ var
|
||||
seriesValue: TDataValue;
|
||||
len: Int64;
|
||||
begin
|
||||
seriesValue := FScope[(Node.Series as TIdentifierNode).Address]; // Changed
|
||||
seriesValue := FScope[Node.Series.AsBoundIdentifierNode.Address]; // Changed
|
||||
|
||||
case seriesValue.Kind of
|
||||
vkSeries: len := seriesValue.AsSeries.Count;
|
||||
|
||||
Reference in New Issue
Block a user