"Constant" procedure values for default values in structs

This commit is contained in:
Ginger Bill
2017-10-01 20:10:13 +01:00
parent 8f39ebbe5a
commit 1f24f105cc
3 changed files with 30 additions and 7 deletions
+10 -2
View File
@@ -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);