aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp15
1 files changed, 14 insertions, 1 deletions
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);
+ }
+}