aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-04-09 11:27:44 +0100
committergingerBill <bill@gingerbill.org>2021-04-09 11:27:44 +0100
commit2d99a348b8f4ae201b2b9d8271fb0d63a2dbc125 (patch)
tree45183386202aecd70d10ea2a53d75c5c9d68d4d1 /src/ir.cpp
parent8169cb48534a8ea4332a434cee6ed8a6ad9203f7 (diff)
Fix proc literal bug not finding the associated `DeclInfo`
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 9fb06582d..0ad48ca27 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -132,6 +132,7 @@ struct irProcedure {
irModule * module;
String name;
Type * type;
+ Ast * proc_lit; // only for actual anonymous procedure literals
Ast * type_expr;
Ast * body;
u64 tags;
@@ -6894,7 +6895,7 @@ irTargetList *ir_push_target_list(irProcedure *proc, Ast *label, irBlock *break_
}
}
- GB_PANIC("ir_set_label_blocks: Unreachable");
+ GB_PANIC("ir_set_label_blocks: Unreachable; Unable to find label: %s", expr_to_string(label->Label.name));
}
return tl;
@@ -6927,6 +6928,7 @@ irValue *ir_gen_anonymous_proc_lit(irModule *m, String prefix_name, Ast *expr, i
set_procedure_abi_types(type);
irValue *value = ir_value_procedure(m, nullptr, type, pl->type, pl->body, name);
+ value->Proc.proc_lit = expr;
value->Proc.tags = pl->tags;
value->Proc.inlining = pl->inlining;
value->Proc.parent = proc;
@@ -11390,6 +11392,10 @@ void ir_begin_procedure_body(irProcedure *proc) {
array_init(&proc->context_stack, heap_allocator());
DeclInfo *decl = decl_info_of_entity(proc->entity);
+ if (decl == nullptr && proc->proc_lit != nullptr) {
+ GB_ASSERT(proc->proc_lit->kind == Ast_ProcLit);
+ decl = proc->proc_lit->ProcLit.decl;
+ }
if (decl != nullptr) {
for_array(i, decl->labels) {
BlockLabel bl = decl->labels[i];