diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-10-18 09:25:36 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-10-18 22:54:00 +0200 |
| commit | 7440060f179e35fe63155a149bb5003c97e12013 (patch) | |
| tree | abdcb8aa74513312b2cc92d4c2b2b986c29fbc03 /boot/ast.cc | |
| parent | 81043b67437445dcf83055098490e04cc88ff7ee (diff) | |
| download | elna-7440060f179e35fe63155a149bb5003c97e12013.tar.gz | |
Fix ICE on variable declarations in case branches
Diffstat (limited to 'boot/ast.cc')
| -rw-r--r-- | boot/ast.cc | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/boot/ast.cc b/boot/ast.cc index 15e4928..e712f16 100644 --- a/boot/ast.cc +++ b/boot/ast.cc @@ -243,7 +243,7 @@ namespace elna::boot } if (declaration->body.has_value()) { - traverse_block(this, declaration->body.value()); + boot::traverse_block(this, declaration->body.value()); if (declaration->body.value().return_expression != nullptr) { declaration->body.value().return_expression->accept(this); @@ -257,54 +257,59 @@ namespace elna::boot statement->rvalue().accept(this); } + void walking_visitor::traverse_block(const block& body) + { + boot::traverse_block(this, body); + } + void walking_visitor::visit(if_statement *statement) { statement->branch().prerequisite().accept(this); - traverse_block(this, statement->branch().body); + traverse_block(statement->branch().body); for (conditional_statements& branch : statement->branches) { branch.prerequisite().accept(this); - traverse_block(this, branch.body); + traverse_block(branch.body); } if (statement->alternative != nullptr) { - traverse_block(this, *statement->alternative); + traverse_block(*statement->alternative); } } void walking_visitor::visit(while_statement *statement) { statement->branch().prerequisite().accept(this); - traverse_block(this, statement->branch().body); + traverse_block(statement->branch().body); for (conditional_statements& branch : statement->branches) { branch.prerequisite().accept(this); - traverse_block(this, branch.body); + traverse_block(branch.body); } } void walking_visitor::visit(repeat_statement *statement) { statement->condition().accept(this); - traverse_block(this, statement->body); + traverse_block(statement->body); } void walking_visitor::visit(for_statement *statement) { statement->range().accept(this); - traverse_block(this, statement->body); + traverse_block(statement->body); } void walking_visitor::visit(defer_statement *statement) { - traverse_block(this, statement->body); + traverse_block(statement->body); } void walking_visitor::visit(block_statement *statement) { - traverse_block(this, statement->body); + traverse_block(statement->body); } void walking_visitor::visit(break_statement *) @@ -321,11 +326,11 @@ namespace elna::boot for (const switch_case& case_block : statement->cases) { visit_all(this, case_block.labels); - traverse_block(this, case_block.body); + traverse_block(case_block.body); } if (statement->alternative != nullptr) { - traverse_block(this, *statement->alternative); + traverse_block(*statement->alternative); } } |
