Finished node immutability
This commit is contained in:
@@ -91,26 +91,6 @@ var
|
||||
left, right: IAstNode;
|
||||
nodeType: IStaticType;
|
||||
begin
|
||||
// Get the type *before* replacing the node (it's an IAstTypedNode)
|
||||
nodeType := Node.AsTypedNode.StaticType;
|
||||
|
||||
// --- Transformation: Keyword-as-Function ---
|
||||
if Node.Callee.Kind = akKeyword then
|
||||
begin
|
||||
var keywordNode := Node.Callee.AsKeyword;
|
||||
if Length(Node.Arguments) <> 1 then
|
||||
raise EArgumentException.CreateFmt(
|
||||
'Keyword :%s expects exactly one argument (the record/map), but got %d',
|
||||
[keywordNode.Value.Name, Length(Node.Arguments)]);
|
||||
|
||||
// Visit the base node
|
||||
var baseNode := Accept(Node.Arguments[0]);
|
||||
|
||||
// Create the new MemberAccess node, preserving the type
|
||||
Result := TAst.MemberAccess(baseNode, keywordNode, nodeType);
|
||||
exit;
|
||||
end;
|
||||
|
||||
// --- Optimization: Operator Folding ---
|
||||
if Node.Callee.Kind = akIdentifier then
|
||||
begin
|
||||
|
||||
Reference in New Issue
Block a user