Macro expander integrated in binder

This commit is contained in:
Michael Schimmel
2025-10-04 19:05:50 +02:00
parent d9219474e0
commit 7c48e9e203
16 changed files with 487 additions and 522 deletions
+9 -1
View File
@@ -74,6 +74,7 @@ type
public
constructor Create(const AValue: TDataValue);
function Accept(const Visitor: IAstVisitor): TDataValue; override;
property Value: TDataValue read GetValue;
end;
TIdentifierNode = class(TAstNode, IIdentifierNode)
@@ -169,6 +170,7 @@ type
public
constructor Create(const AExpression: IAstNode);
function Accept(const Visitor: IAstVisitor): TDataValue; override;
property Expression: IAstNode read GetExpression;
end;
TUnquoteNode = class(TAstNode, IUnquoteNode)
@@ -865,7 +867,13 @@ end;
class function TAst.IfExpr(const ACondition: IAstNode; const AThenBranch, AElseBranch: IAstNode): IIfExpressionNode;
begin
Result := TIfExpressionNode.Create(ACondition, AThenBranch, AElseBranch);
Result :=
TIfExpressionNode.Create(
ACondition,
AThenBranch,
if AElseBranch = nil then TBlockExpressionNode.Create([]) as IAstNode
else AElseBranch
);
end;
class function TAst.Indexer(const ABase: IAstNode; const AIndex: IAstNode): IIndexerNode;