aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-10-01 20:10:13 +0100
committerGinger Bill <bill@gingerbill.org>2017-10-01 20:10:13 +0100
commit1f24f105cc49cff6bbe1034215ae86cb4450f831 (patch)
treebaaa36721f662c9d6c98b6fa49996110174a3c7c /src/ir_print.cpp
parent8f39ebbe5a7628e8d4597d39f9253c23fead53a6 (diff)
"Constant" procedure values for default values in structs
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index 8b728acdf..a1b2a1d03 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -701,10 +701,18 @@ void ir_print_exact_value(irFileBuffer *f, irModule *m, ExactValue value, Type *
}
case ExactValue_Procedure: {
+ irValue **found = nullptr;
AstNode *expr = value.value_procedure;
GB_ASSERT(expr != nullptr);
- GB_ASSERT(expr->kind == AstNode_ProcLit);
- irValue **found = map_get(&m->anonymous_proc_lits, hash_pointer(expr));
+
+ if (expr->kind == AstNode_ProcLit) {
+ found = map_get(&m->anonymous_proc_lits, hash_pointer(expr));
+ } else {
+ GB_ASSERT(expr->kind == AstNode_Ident);
+ Entity *e = entity_of_ident(m->info, expr);
+ GB_ASSERT(e != nullptr);
+ found = map_get(&m->values, hash_entity(e));
+ }
GB_ASSERT(found != nullptr);
irValue *val = *found;
ir_print_value(f, m, val, type);