mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix type checking for invalid enum backing type
This commit is contained in:
+3
-1
@@ -790,6 +790,9 @@ gb_internal void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *nam
|
|||||||
ast_node(et, EnumType, node);
|
ast_node(et, EnumType, node);
|
||||||
GB_ASSERT(is_type_enum(enum_type));
|
GB_ASSERT(is_type_enum(enum_type));
|
||||||
|
|
||||||
|
enum_type->Enum.base_type = t_int;
|
||||||
|
enum_type->Enum.scope = ctx->scope;
|
||||||
|
|
||||||
Type *base_type = t_int;
|
Type *base_type = t_int;
|
||||||
if (et->base_type != nullptr) {
|
if (et->base_type != nullptr) {
|
||||||
base_type = check_type(ctx, et->base_type);
|
base_type = check_type(ctx, et->base_type);
|
||||||
@@ -811,7 +814,6 @@ gb_internal void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *nam
|
|||||||
|
|
||||||
// NOTE(bill): Must be up here for the 'check_init_constant' system
|
// NOTE(bill): Must be up here for the 'check_init_constant' system
|
||||||
enum_type->Enum.base_type = base_type;
|
enum_type->Enum.base_type = base_type;
|
||||||
enum_type->Enum.scope = ctx->scope;
|
|
||||||
|
|
||||||
auto fields = array_make<Entity *>(permanent_allocator(), 0, et->fields.count);
|
auto fields = array_make<Entity *>(permanent_allocator(), 0, et->fields.count);
|
||||||
|
|
||||||
|
|||||||
+1
-5
@@ -768,6 +768,7 @@ gb_internal i64 type_offset_of (Type *t, i64 index, Type **field_type_=null
|
|||||||
gb_internal gbString type_to_string (Type *type, bool shorthand=true);
|
gb_internal gbString type_to_string (Type *type, bool shorthand=true);
|
||||||
gb_internal gbString type_to_string (Type *type, gbAllocator allocator, bool shorthand=true);
|
gb_internal gbString type_to_string (Type *type, gbAllocator allocator, bool shorthand=true);
|
||||||
gb_internal i64 type_size_of_internal(Type *t, TypePath *path);
|
gb_internal i64 type_size_of_internal(Type *t, TypePath *path);
|
||||||
|
gb_internal i64 type_align_of_internal(Type *t, TypePath *path);
|
||||||
gb_internal void init_map_internal_types(Type *type);
|
gb_internal void init_map_internal_types(Type *type);
|
||||||
gb_internal Type * bit_set_to_int(Type *t);
|
gb_internal Type * bit_set_to_int(Type *t);
|
||||||
gb_internal bool are_types_identical(Type *x, Type *y);
|
gb_internal bool are_types_identical(Type *x, Type *y);
|
||||||
@@ -780,9 +781,6 @@ gb_internal bool is_type_slice(Type *t);
|
|||||||
gb_internal bool is_type_integer(Type *t);
|
gb_internal bool is_type_integer(Type *t);
|
||||||
gb_internal bool type_set_offsets(Type *t);
|
gb_internal bool type_set_offsets(Type *t);
|
||||||
|
|
||||||
gb_internal i64 type_size_of_internal(Type *t, TypePath *path);
|
|
||||||
gb_internal i64 type_align_of_internal(Type *t, TypePath *path);
|
|
||||||
|
|
||||||
|
|
||||||
// IMPORTANT TODO(bill): SHould this TypePath code be removed since type cycle checking is handled much earlier on?
|
// IMPORTANT TODO(bill): SHould this TypePath code be removed since type cycle checking is handled much earlier on?
|
||||||
|
|
||||||
@@ -3576,8 +3574,6 @@ gb_internal Slice<i32> struct_fields_index_by_increasing_offset(gbAllocator allo
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
gb_internal i64 type_size_of_internal (Type *t, TypePath *path);
|
|
||||||
gb_internal i64 type_align_of_internal(Type *t, TypePath *path);
|
|
||||||
gb_internal i64 type_size_of(Type *t);
|
gb_internal i64 type_size_of(Type *t);
|
||||||
gb_internal i64 type_align_of(Type *t);
|
gb_internal i64 type_align_of(Type *t);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user