diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-10-01 14:10:31 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-10-01 14:10:31 +0100 |
| commit | e7e51f53ce4c63727f46d8f6b2b06a1580900d74 (patch) | |
| tree | 88932135e9b8c5ee01de192cb4732b4dcb15a48d /src/ir_print.cpp | |
| parent | 5259de58722ed8e32f20c9c859b3d9fac8a526a3 (diff) | |
Fix cyclic polymorphic struct bug #111
Diffstat (limited to 'src/ir_print.cpp')
| -rw-r--r-- | src/ir_print.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp index ec60bbc41..70a1defb5 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -348,9 +348,15 @@ void ir_print_type(irFileBuffer *f, irModule *m, Type *t) { switch (base_type(t)->kind) { case Type_Struct: case Type_Union: { - String *name = map_get(&m->entity_names, hash_pointer(t->Named.type_name)); - GB_ASSERT_MSG(name != nullptr, "%.*s %p", LIT(t->Named.name), t->Named.type_name); - ir_print_encoded_local(f, *name); + GB_ASSERT(t->Named.type_name != nullptr); + String *found = map_get(&m->entity_names, hash_entity(t->Named.type_name)); + if (found) { + ir_print_encoded_local(f, *found); + } else { + // TODO(bill): Is this correct behaviour?! + ir_print_type(f, m, base_type(t)); + // GB_ASSERT_MSG(found != nullptr, "%.*s %p", LIT(t->Named.name), t->Named.type_name); + } } break; default: ir_print_type(f, m, base_type(t)); |