diff options
| author | gingerBill <bill@gingerbill.org> | 2022-11-08 11:13:46 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-11-08 11:13:46 +0000 |
| commit | 810a1eee41cc8e047759c8934af70d6e68113082 (patch) | |
| tree | e24c9cd4ae4e63997ae5ffd636b55d923adc2e8e /src/check_type.cpp | |
| parent | e3e225d21b613d789ebad0273b198b5509800bf0 (diff) | |
Remove the need for `type->Map.internal_type` and replace with the definition of `runtime.Raw_Map`
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 39344fb2c..5d7f8d7b5 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2198,34 +2198,14 @@ void map_cell_size_and_len(Type *type, i64 *size_, i64 *len_) { void init_map_internal_types(Type *type) { GB_ASSERT(type->kind == Type_Map); GB_ASSERT(t_allocator != nullptr); - if (type->Map.internal_type != nullptr) return; + if (type->Map.lookup_result_type != nullptr) return; Type *key = type->Map.key; Type *value = type->Map.value; GB_ASSERT(key != nullptr); GB_ASSERT(value != nullptr); - Type *generated_struct_type = alloc_type_struct(); - - /* - struct { - data: uintptr, - size: uintptr, - allocator: runtime.Allocator, - } - */ - Scope *s = create_scope(nullptr, builtin_pkg->scope); - - auto fields = slice_make<Entity *>(permanent_allocator(), 3); - fields[0] = alloc_entity_field(s, make_token_ident(str_lit("data")), t_uintptr, false, 0, EntityState_Resolved); - fields[1] = alloc_entity_field(s, make_token_ident(str_lit("size")), t_uintptr, false, 1, EntityState_Resolved); - fields[2] = alloc_entity_field(s, make_token_ident(str_lit("allocator")), t_allocator, false, 2, EntityState_Resolved); - - generated_struct_type->Struct.fields = fields; - type_set_offsets(generated_struct_type); - - type->Map.internal_type = generated_struct_type; - type->Map.lookup_result_type = make_optional_ok_type(value); + type->Map.lookup_result_type = make_optional_ok_type(value); } void add_map_key_type_dependencies(CheckerContext *ctx, Type *key) { |