From 82101198f1ff2438f5db61d3a85eee3e0e1b95db Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 18 Dec 2016 20:09:34 -0500 Subject: workaround for Arch being a primitive type --- src/analyze.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index 950254b7e9..c42df80c7a 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -786,7 +786,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) { gen_param_info->src_index = i; gen_param_info->gen_index = SIZE_MAX; - assert(type_is_complete(type_entry)); + ensure_complete_type(g, type_entry); if (type_has_bits(type_entry)) { TypeTableEntry *gen_type; if (handle_is_ptr(type_entry)) { @@ -2911,3 +2911,16 @@ ConstExprValue *create_const_bool(bool value) { init_const_bool(const_val, value); return const_val; } + +void ensure_complete_type(CodeGen *g, TypeTableEntry *type_entry) { + if (type_entry->id == TypeTableEntryIdStruct) { + if (!type_entry->data.structure.complete) + resolve_struct_type(g, type_entry); + } else if (type_entry->id == TypeTableEntryIdEnum) { + if (!type_entry->data.enumeration.complete) + resolve_enum_type(g, type_entry); + } else if (type_entry->id == TypeTableEntryIdUnion) { + if (!type_entry->data.unionation.complete) + resolve_union_type(g, type_entry); + } +} -- cgit v1.2.3