From 3a189b9c1ca273105ba030322e151efd85825482 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Thu, 25 Aug 2016 19:52:51 +0100 Subject: Save before Demo 001 --- src/checker/type.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/checker/type.cpp') 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)); -- cgit v1.2.3