Ast series indexer

This commit is contained in:
Michael Schimmel
2025-09-02 16:58:52 +02:00
parent 375e64411b
commit a83bbf4f54
11 changed files with 734 additions and 79 deletions
+19 -2
View File
@@ -33,6 +33,7 @@ type
function VisitBlockExpression(const Node: IBlockExpressionNode): TAstValue;
function VisitVariableDeclaration(const Node: IVariableDeclarationNode): TAstValue;
function VisitAssignment(const Node: IAssignmentNode): TAstValue;
function VisitIndexer(const Node: IIndexerNode): TAstValue;
end;
implementation
@@ -64,12 +65,12 @@ end;
procedure TPrettyPrintVisitor.Indent;
begin
inc(FIndentLevel, 2);
inc(FIndentLevel, 4);
end;
procedure TPrettyPrintVisitor.Unindent;
begin
dec(FIndentLevel, 2);
dec(FIndentLevel, 4);
end;
procedure TPrettyPrintVisitor.AppendLine(const S: string);
@@ -225,4 +226,20 @@ begin
Result := TAstValue.Void;
end;
function TPrettyPrintVisitor.VisitIndexer(const Node: IIndexerNode): TAstValue;
begin
AppendLine('Indexer');
Indent;
AppendLine('Base:');
Indent;
Node.Base.Accept(Self);
Unindent;
AppendLine('Index:');
Indent;
Node.Index.Accept(Self);
Unindent;
Unindent;
Result := TAstValue.Void;
end;
end.