AST refactoring

This commit is contained in:
Michael Schimmel
2025-08-29 10:01:03 +02:00
parent fa9328a183
commit d2c00c6033
4 changed files with 79 additions and 45 deletions
+10 -10
View File
@@ -80,13 +80,13 @@ end;
function TPrettyPrintVisitor.VisitConstant(const Node: IConstantNode): TAstValue;
begin
AppendLine(Format('Constant (%s)', [Node.Value.ToString]));
Result := TAstValue.Undefined;
Result := TAstValue.Void;
end;
function TPrettyPrintVisitor.VisitIdentifier(const Node: IIdentifierNode): TAstValue;
begin
AppendLine(Format('Identifier (%s)', [Node.Name]));
Result := TAstValue.Undefined;
Result := TAstValue.Void;
end;
function TPrettyPrintVisitor.VisitBinaryExpression(const Node: IBinaryExpressionNode): TAstValue;
@@ -96,7 +96,7 @@ begin
Node.Left.Accept(Self);
Node.Right.Accept(Self);
Unindent;
Result := TAstValue.Undefined;
Result := TAstValue.Void;
end;
function TPrettyPrintVisitor.VisitUnaryExpression(const Node: IUnaryExpressionNode): TAstValue;
@@ -105,7 +105,7 @@ begin
Indent;
Node.Right.Accept(Self);
Unindent;
Result := TAstValue.Undefined;
Result := TAstValue.Void;
end;
function TPrettyPrintVisitor.VisitIfExpression(const Node: IIfExpressionNode): TAstValue;
@@ -125,7 +125,7 @@ begin
Node.ElseBranch.Accept(Self);
Unindent;
Unindent;
Result := TAstValue.Undefined;
Result := TAstValue.Void;
end;
function TPrettyPrintVisitor.VisitLambdaExpression(const Node: ILambdaExpressionNode): TAstValue;
@@ -148,7 +148,7 @@ begin
Node.Body.Accept(Self);
Unindent;
Unindent;
Result := TAstValue.Undefined;
Result := TAstValue.Void;
end;
function TPrettyPrintVisitor.VisitFunctionCall(const Node: IFunctionCallNode): TAstValue;
@@ -167,7 +167,7 @@ begin
arg.Accept(Self);
Unindent;
Unindent;
Result := TAstValue.Undefined;
Result := TAstValue.Void;
end;
function TPrettyPrintVisitor.VisitBlockExpression(const Node: IBlockExpressionNode): TAstValue;
@@ -179,7 +179,7 @@ begin
for expr in Node.Expressions do
expr.Accept(Self);
Unindent;
Result := TAstValue.Undefined;
Result := TAstValue.Void;
end;
function TPrettyPrintVisitor.VisitVariableDeclaration(const Node: IVariableDeclarationNode): TAstValue;
@@ -191,7 +191,7 @@ begin
Node.Initializer.Accept(Self);
Unindent;
end;
Result := TAstValue.Undefined;
Result := TAstValue.Void;
end;
function TPrettyPrintVisitor.VisitAssignment(const Node: IAssignmentNode): TAstValue;
@@ -201,7 +201,7 @@ begin
Indent;
Node.Value.Accept(Self);
Unindent;
Result := TAstValue.Undefined;
Result := TAstValue.Void;
end;
end.