diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-07-10 22:59:23 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-07-10 22:59:23 +0100 |
| commit | ba5050ac7c2eb116b8989b7d387e67eb79eec62a (patch) | |
| tree | d36d5cc1c9c6e31c88b27109792f21ca21e8a23f /src/checker.cpp | |
| parent | d936ca1ea003f82e0fda330cbad1f5bcf4387df2 (diff) | |
Compiler Internal Changes: TypeRecord_Union -> Type_Union
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index cbb6afe0d..e47ad9aa2 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -1152,20 +1152,17 @@ void add_type_info_type(Checker *c, Type *t) { add_type_info_type(c, bt->Enum.base_type); break; + case Type_Union: + add_type_info_type(c, t_int); + for (isize i = 0; i < bt->Union.variant_count; i++) { + add_type_info_type(c, bt->Union.variants[i]); + } + break; + case Type_Record: { - switch (bt->Record.kind) { - case TypeRecord_Union: - add_type_info_type(c, t_int); - for (isize i = 0; i < bt->Record.variant_count; i++) { - add_type_info_type(c, bt->Record.variants[i]); - } - /* fallthrough */ - default: - for (isize i = 0; i < bt->Record.field_count; i++) { - Entity *f = bt->Record.fields[i]; - add_type_info_type(c, f->type); - } - break; + for (isize i = 0; i < bt->Record.field_count; i++) { + Entity *f = bt->Record.fields[i]; + add_type_info_type(c, f->type); } } break; @@ -1343,7 +1340,7 @@ void init_preload(Checker *c) { Entity *type_info_variant = record->fields_in_src_order[2]; Type *tiv_type = type_info_variant->type; GB_ASSERT(is_type_union(tiv_type)); - TypeRecord *tiv = &tiv_type->Record; + TypeUnion *tiv = &tiv_type->Union; if (tiv->variant_count != 23) { compiler_error("Invalid `TypeInfo` layout"); |