aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index d3a5c94aa1..eb43575d62 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -1739,6 +1739,9 @@ bool type_is_invalid(TypeTableEntry *type_entry) {
static Error resolve_enum_type(CodeGen *g, TypeTableEntry *enum_type) {
assert(enum_type->id == TypeTableEntryIdEnum);
+ if (enum_type->data.enumeration.is_invalid)
+ return ErrorSemanticAnalyzeFail;
+
if (enum_type->data.enumeration.complete)
return ErrorNone;
@@ -2536,7 +2539,9 @@ static Error resolve_enum_zero_bits(CodeGen *g, TypeTableEntry *enum_type) {
enum_type->data.enumeration.zero_bits_loop_flag = false;
enum_type->zero_bits = !type_has_bits(tag_int_type);
enum_type->data.enumeration.zero_bits_known = true;
- assert(!enum_type->data.enumeration.is_invalid);
+
+ if (enum_type->data.enumeration.is_invalid)
+ return ErrorSemanticAnalyzeFail;
return ErrorNone;
}
@@ -2546,6 +2551,9 @@ static Error resolve_struct_zero_bits(CodeGen *g, TypeTableEntry *struct_type) {
Error err;
+ if (struct_type->data.structure.is_invalid)
+ return ErrorSemanticAnalyzeFail;
+
if (struct_type->data.structure.zero_bits_known)
return ErrorNone;
@@ -2662,6 +2670,9 @@ static Error resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) {
Error err;
+ if (union_type->data.unionation.is_invalid)
+ return ErrorSemanticAnalyzeFail;
+
if (union_type->data.unionation.zero_bits_known)
return ErrorNone;
@@ -2992,7 +3003,10 @@ static Error resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) {
union_type->data.unionation.gen_field_count = gen_field_index;
union_type->zero_bits = (gen_field_index == 0 && (field_count < 2 || !src_have_tag));
union_type->data.unionation.zero_bits_known = true;
- assert(!union_type->data.unionation.is_invalid);
+
+ if (union_type->data.unionation.is_invalid)
+ return ErrorSemanticAnalyzeFail;
+
return ErrorNone;
}