Node immutability improved

This commit is contained in:
Michael Schimmel
2025-11-05 18:13:43 +01:00
parent 0915d6d90d
commit 1f0eef7698
11 changed files with 409 additions and 308 deletions
+15 -13
View File
@@ -454,9 +454,10 @@ begin
begin
for var expr in rootNode.AsBlockExpression.Expressions do
begin
if expr is TVariableDeclarationNode then
// Use interface 'is' check
if (expr.Kind = akVariableDeclaration) then
begin
var decl := expr as TVariableDeclarationNode;
var decl := expr.AsVariableDeclaration;
definitions.Add(decl.Identifier.Name, decl.Initializer);
end
// Handle macro definitions inside the block
@@ -468,9 +469,10 @@ begin
end;
end;
end
else if rootNode is TVariableDeclarationNode then // Handle single definition
// Use interface 'is' check
else if rootNode.Kind = akVariableDeclaration then // Handle single definition
begin
var decl := rootNode as TVariableDeclarationNode;
var decl := rootNode.AsVariableDeclaration;
definitions.Add(decl.Identifier.Name, decl.Initializer);
end
// Handle a single macro definition
@@ -828,7 +830,7 @@ begin
TAst.VarDecl(
TAst.Identifier('closeColumn'),
TAst.FunctionCall(TAst.Keyword('Close'), [TAst.Identifier('ohlcvSeries')])
// TAst.MemberAccess(TAst.Identifier('ohlcvSeries'), TAst.Identifier('Close'))
// TAst.MemberAccess(TAst.Identifier('ohlcvSeries'), TAst.Identifier('Close'))
),
TAst.Indexer(TAst.Identifier('closeColumn'), TAst.Constant(1))
]
@@ -1348,14 +1350,14 @@ begin
FWorkspace.Build(FCurrUnboundAst, TPointF.Create(X, Y));
//
// if FCurrAst <> nil then
// begin
// FWorkspace.Build(FCurrAst, TPointF.Create(X, Y));
// end
// else if FCurrUnboundAst <> nil then
// begin
// FWorkspace.Build(FCurrUnboundAst, TPointF.Create(X, Y));
// end;
// if FCurrAst <> nil then
// begin
// FWorkspace.Build(FCurrAst, TPointF.Create(X, Y));
// end
// else if FCurrUnboundAst <> nil then
// begin
// FWorkspace.Build(FCurrUnboundAst, TPointF.Create(X, Y));
// end;
end;
end.