mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-18 00:41:26 -07:00
Fix issue #122
This commit is contained in:
+13
-12
@@ -664,19 +664,20 @@ bool ir_type_has_default_values(Type *t) {
|
||||
return ir_type_has_default_values(t->Array.elem);
|
||||
|
||||
case Type_Struct:
|
||||
if (!t->Struct.is_raw_union) {
|
||||
for_array(i, t->Struct.fields) {
|
||||
Entity *f = t->Struct.fields_in_src_order[i];
|
||||
if (f->kind != Entity_Variable) continue;
|
||||
if (f->Variable.default_is_nil) {
|
||||
// NOTE(bill): This is technically zero
|
||||
continue;
|
||||
} else if (f->Variable.default_value.kind != ExactValue_Invalid) {
|
||||
return true;
|
||||
} else if (f->Variable.default_is_undef) {
|
||||
return true;
|
||||
}
|
||||
if (t->Struct.is_raw_union) return false;
|
||||
for_array(i, t->Struct.fields) {
|
||||
Entity *f = t->Struct.fields_in_src_order[i];
|
||||
if (f->kind != Entity_Variable) continue;
|
||||
if (f->Variable.default_is_nil) {
|
||||
// NOTE(bill): This is technically zero
|
||||
continue;
|
||||
} else if (f->Variable.default_value.kind != ExactValue_Invalid) {
|
||||
return true;
|
||||
} else if (f->Variable.default_is_undef) {
|
||||
return true;
|
||||
}
|
||||
bool sub = ir_type_has_default_values(f->type);
|
||||
if (sub) return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user