aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-12-18 20:09:34 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-12-18 20:09:34 -0500
commit82101198f1ff2438f5db61d3a85eee3e0e1b95db (patch)
tree74e197e1000e88677b40629cc0f6ec40223f1923 /src/analyze.cpp
parenta71fbe49cbbf068e00300533d5f3874efadb8c18 (diff)
downloadzig-82101198f1ff2438f5db61d3a85eee3e0e1b95db.tar.gz
zig-82101198f1ff2438f5db61d3a85eee3e0e1b95db.zip
workaround for Arch being a primitive type
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);
+ }
+}