From d0faa92ab52185dd838c0be16d15c21cfd86e7e0 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Wed, 29 Dec 2021 22:03:31 -0600 Subject: [PATCH] bugfix with polymorphic tags --- core/conv.onyx | 2 +- src/wasm_type_table.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/conv.onyx b/core/conv.onyx index 87038084..0749a0ef 100644 --- a/core/conv.onyx +++ b/core/conv.onyx @@ -397,7 +397,7 @@ format_any :: (output: ^Format_Output, formatting: ^Format, v: any) { } } - if custom_formatters[v.type] != null_proc { + if custom_formatters->has(v.type) { custom_formatters[v.type](output, formatting, v.data); return; } diff --git a/src/wasm_type_table.h b/src/wasm_type_table.h index 18c08bca..b32e8551 100644 --- a/src/wasm_type_table.h +++ b/src/wasm_type_table.h @@ -408,7 +408,6 @@ u64 build_type_table(OnyxWasmModule* module) { i32 i = 0; bh_arr_each(AstTyped *, tag, type->PolyStruct.meta_tags) { AstTyped* value = *tag; - assert(value->type); // Polymorphic structs are weird in this case, because the tag might not be constructed generically for // the polymorphic structure so it should only be constructed for actual solidified structures. @@ -418,6 +417,8 @@ u64 build_type_table(OnyxWasmModule* module) { continue; } + assert(value->type); + u32 size = type_size_of(value->type); bh_buffer_align(&table_buffer, type_alignment_of(value->type)); tag_locations[i] = table_buffer.length; -- 2.25.1