diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-08-25 19:52:51 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-08-25 19:52:51 +0100 |
| commit | 3a189b9c1ca273105ba030322e151efd85825482 (patch) | |
| tree | 126679aa7ec0bffb6752045419087416be3588bf /src/checker/type.cpp | |
| parent | f93cf3827ba5cde4f054db99b9815cb2a18ba861 (diff) | |
Save before Demo 001
Diffstat (limited to 'src/checker/type.cpp')
| -rw-r--r-- | src/checker/type.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/checker/type.cpp b/src/checker/type.cpp index fe5aaf5ce..26bb2dc40 100644 --- a/src/checker/type.cpp +++ b/src/checker/type.cpp @@ -143,7 +143,10 @@ struct Type { }; Type *get_base_type(Type *t) { - while (t->kind == Type_Named) { + for (;;) { + if (t == NULL || t->kind != Type_Named) { + break; + } t = t->Named.base; } return t; @@ -583,6 +586,8 @@ gb_global i64 basic_type_sizes[] = { 8, // Basic_f64 }; + + i64 type_size_of(BaseTypeSizes s, gbAllocator allocator, Type *t); i64 type_align_of(BaseTypeSizes s, gbAllocator allocator, Type *t); i64 type_offset_of(BaseTypeSizes s, gbAllocator allocator, Type *t, i64 index); @@ -668,6 +673,7 @@ b32 type_set_offsets(BaseTypeSizes s, gbAllocator allocator, Type *t) { i64 type_size_of(BaseTypeSizes s, gbAllocator allocator, Type *t) { t = get_base_type(t); + switch (t->kind) { case Type_Basic: { GB_ASSERT(is_type_typed(t)); |