bugfix with polymorphic tags
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 30 Dec 2021 04:03:31 +0000 (22:03 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 30 Dec 2021 04:03:31 +0000 (22:03 -0600)
core/conv.onyx
src/wasm_type_table.h

index 87038084af30beeda747931ef245639b1290bfe5..0749a0efc895139b4205bf368686b445a64b449b 100644 (file)
@@ -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;
     }
index 18c08bca65f24aa63fff747b5c3e685a449bbfa7..b32e85516f1b8c75c6eaf53766120c342d7efeea 100644 (file)
@@ -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;