diff options
| author | gingerBill <bill@gingerbill.org> | 2023-07-19 14:19:01 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-07-19 14:19:01 +0100 |
| commit | b2edab193f26355020c5c13af432145712d8cf0f (patch) | |
| tree | adf8460f23490425ce748895211c61dcc79dcf8c /src/tilde_proc.cpp | |
| parent | 184563bbe1f55be17f39cdc13cb784a562419b75 (diff) | |
Support branch statements `break`/`continue`/`fallthrough`
Diffstat (limited to 'src/tilde_proc.cpp')
| -rw-r--r-- | src/tilde_proc.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tilde_proc.cpp b/src/tilde_proc.cpp index 7f67f3a5c..f51435390 100644 --- a/src/tilde_proc.cpp +++ b/src/tilde_proc.cpp @@ -68,7 +68,7 @@ gb_internal cgProcedure *cg_procedure_create(cgModule *m, Entity *entity, bool i p->children.allocator = a; // p->defer_stmts.allocator = a; // p->blocks.allocator = a; - // p->branch_blocks.allocator = a; + p->branch_blocks.allocator = a; p->context_stack.allocator = a; p->scope_stack.allocator = a; map_init(&p->variable_map); @@ -128,7 +128,7 @@ gb_internal cgProcedure *cg_procedure_create_dummy(cgModule *m, String const &li p->children.allocator = a; // p->defer_stmts.allocator = a; // p->blocks.allocator = a; - // p->branch_blocks.allocator = a; + p->branch_blocks.allocator = a; p->scope_stack.allocator = a; p->context_stack.allocator = a; map_init(&p->variable_map); @@ -165,6 +165,16 @@ gb_internal void cg_procedure_begin(cgProcedure *p) { return; } + + DeclInfo *decl = decl_info_of_entity(p->entity); + if (decl != nullptr) { + for_array(i, decl->labels) { + BlockLabel bl = decl->labels[i]; + cgBranchBlocks bb = {bl.label, nullptr, nullptr}; + array_add(&p->branch_blocks, bb); + } + } + GB_ASSERT(p->type->kind == Type_Proc); TypeProc *pt = &p->type->Proc; if (pt->params == nullptr) { |