diff options
| author | gingerBill <bill@gingerbill.org> | 2021-09-18 15:10:29 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-09-18 15:10:29 +0100 |
| commit | 71f2289c20c55ced92225fea97df66b1e53f3c37 (patch) | |
| tree | 978d666b054b9d7b616ccb302e3034829dce1a5e /src/check_type.cpp | |
| parent | 05ac2002e0296c3acccca1d8cffaafb002e43120 (diff) | |
Fix #1174
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index ffdc22898..b7bcfdc13 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2072,14 +2072,16 @@ void init_map_entry_type(Type *type) { Scope *s = create_scope(nullptr, builtin_pkg->scope); auto fields = slice_make<Entity *>(permanent_allocator(), 4); - fields[0] = alloc_entity_field(s, make_token_ident(str_lit("hash")), t_uintptr, false, cast(i32)fields.count, EntityState_Resolved); - fields[1] = alloc_entity_field(s, make_token_ident(str_lit("next")), t_int, false, cast(i32)fields.count, EntityState_Resolved); - fields[2] = alloc_entity_field(s, make_token_ident(str_lit("key")), type->Map.key, false, cast(i32)fields.count, EntityState_Resolved); - fields[3] = alloc_entity_field(s, make_token_ident(str_lit("value")), type->Map.value, false, cast(i32)fields.count, EntityState_Resolved); + fields[0] = alloc_entity_field(s, make_token_ident(str_lit("hash")), t_uintptr, false, 0, EntityState_Resolved); + fields[1] = alloc_entity_field(s, make_token_ident(str_lit("next")), t_int, false, 1, EntityState_Resolved); + fields[2] = alloc_entity_field(s, make_token_ident(str_lit("key")), type->Map.key, false, 2, EntityState_Resolved); + fields[3] = alloc_entity_field(s, make_token_ident(str_lit("value")), type->Map.value, false, 3, EntityState_Resolved); - entry_type->Struct.fields = fields; - + entry_type->Struct.fields = fields; + entry_type->Struct.tags = gb_alloc_array(permanent_allocator(), String, fields.count); + + type_set_offsets(entry_type); type->Map.entry_type = entry_type; } @@ -2113,8 +2115,8 @@ void init_map_internal_types(Type *type) { fields[1] = alloc_entity_field(s, make_token_ident(str_lit("entries")), entries_type, false, 1, EntityState_Resolved); generated_struct_type->Struct.fields = fields; - type_set_offsets(generated_struct_type); + type->Map.generated_struct_type = generated_struct_type; type->Map.internal_type = generated_struct_type; type->Map.lookup_result_type = make_optional_ok_type(value); |