Skip to content

Commit

Permalink
[AST] dump if condition
Browse files Browse the repository at this point in the history
  • Loading branch information
isuckatcs committed Jun 28, 2024
1 parent 77d436d commit 789781c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ struct IfStmt : public Stmt {
void dump(size_t level = 0) const override {
std::cerr << indent(level) << "IfStmt\n";

condition->dump(level + 1);
trueBlock->dump(level + 1);
if (falseBlock)
falseBlock->dump(level + 1);
Expand Down Expand Up @@ -370,6 +371,7 @@ struct ResolvedIfStmt : public ResolvedStmt {
void dump(size_t level = 0) const override {
std::cerr << indent(level) << "ResolvedIfStmt\n";

condition->dump(level + 1);
trueBlock->dump(level + 1);
if (falseBlock)
falseBlock->dump(level + 1);
Expand Down
6 changes: 6 additions & 0 deletions test/parser/error_recovery_inside_block.al
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ fn error(x: number): void {
// CHECK-NEXT: ParamDecl: x:number
// CHECK-NEXT: Block
// CHECK-NEXT: IfStmt
// CHECK-NEXT: BinaryOperator: '=='
// CHECK-NEXT: DeclRefExpr: x
// CHECK-NEXT: NumberLiteral: '0.0'
// CHECK-NEXT: Block
// CHECK-NEXT: IfStmt
// CHECK-NEXT: BinaryOperator: '=='
// CHECK-NEXT: DeclRefExpr: x
// CHECK-NEXT: NumberLiteral: '2.0
// CHECK-NEXT: Block
// CHECK-NEXT: NumberLiteral: '0.0'
// CHECK-NEXT: Block
Expand Down

0 comments on commit 789781c

Please sign in to comment.