From: Brendan Hansen Date: Thu, 30 Dec 2021 04:03:31 +0000 (-0600) Subject: bugfix with polymorphic tags X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=d0faa92ab52185dd838c0be16d15c21cfd86e7e0;p=onyx.git bugfix with polymorphic tags --- 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;