Refactoring for immutable nodes
This commit is contained in:
@@ -401,7 +401,7 @@ begin
|
||||
if sym.Address.Kind = akUnresolved then
|
||||
begin
|
||||
// Distinguish between loading a macro and loading a function.
|
||||
if funcAst is TMacroDefinitionNode then
|
||||
if funcAst.Kind = akMacroDefinition then
|
||||
begin
|
||||
// Macros are stored as raw AST nodes in the scope.
|
||||
FGScope.Define(pair.JsonString.Value, TDataValue.FromIntf<IAstNode>(funcAst));
|
||||
@@ -461,9 +461,9 @@ begin
|
||||
definitions.Add(decl.Identifier.Name, decl.Initializer);
|
||||
end
|
||||
// Handle macro definitions inside the block
|
||||
else if expr is TMacroDefinitionNode then
|
||||
else if expr.Kind = akMacroDefinition then
|
||||
begin
|
||||
var macroDef := expr as TMacroDefinitionNode;
|
||||
var macroDef := expr.AsMacroDefinition;
|
||||
// Store the entire macro definition node for serialization.
|
||||
definitions.Add(macroDef.Name.Name, macroDef);
|
||||
end;
|
||||
@@ -475,9 +475,9 @@ begin
|
||||
definitions.Add(decl.Identifier.Name, decl.Initializer);
|
||||
end
|
||||
// Handle a single macro definition
|
||||
else if rootNode is TMacroDefinitionNode then
|
||||
else if rootNode.Kind = akMacroDefinition then
|
||||
begin
|
||||
var macroDef := rootNode as TMacroDefinitionNode;
|
||||
var macroDef := rootNode.AsMacroDefinition;
|
||||
definitions.Add(macroDef.Name.Name, macroDef);
|
||||
end;
|
||||
|
||||
|
||||
@@ -1809,7 +1809,7 @@ end;
|
||||
|
||||
function TMacroExpansionNodeHandler.ReconstructAst(OwnerNode: TAuraNode): IAstNode;
|
||||
begin
|
||||
Result := TAst.MacroExpansionNode(FNode.CallNode, FExpandedBodyNode.CreateAst);
|
||||
Result := TAst.MacroExpansionNode(FNode.CallNode, FExpandedBodyNode.CreateAst.AsTypedNode);
|
||||
end;
|
||||
|
||||
{ TRecurNodeHandler }
|
||||
|
||||
Reference in New Issue
Block a user