diff options
| author | gingerBill <bill@gingerbill.org> | 2020-11-23 18:25:01 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-11-23 18:25:01 +0000 |
| commit | 91758656f6027668d9a5c713812c012ac1b38008 (patch) | |
| tree | 6f3039199417b99b309395633599e144e3156fe1 /src/check_type.cpp | |
| parent | 4762d2f2d15d64e012e2de876f1fd78c3ebd7c3e (diff) | |
Change internal layout of `map[K]V`
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index a3b71a034..bcc6b60db 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2789,18 +2789,20 @@ void init_map_entry_type(Type *type) { /* struct { - key: runtime.Map_Key, - next: int, - value: Value, + hash: runtime.Map_Hash, + next: int, + key: Key, + value: Value, } */ Ast *dummy_node = alloc_ast_node(nullptr, Ast_Invalid); Scope *s = create_scope(builtin_pkg->scope); auto fields = array_make<Entity *>(permanent_allocator(), 0, 4); - array_add(&fields, alloc_entity_field(s, make_token_ident(str_lit("key")), t_map_hash, false, cast(i32)fields.count, EntityState_Resolved)); - array_add(&fields, alloc_entity_field(s, make_token_ident(str_lit("next")), t_int, false, cast(i32)fields.count, EntityState_Resolved)); - array_add(&fields, alloc_entity_field(s, make_token_ident(str_lit("value")), type->Map.value, false, cast(i32)fields.count, EntityState_Resolved)); + array_add(&fields, alloc_entity_field(s, make_token_ident(str_lit("hash")), t_map_hash, false, cast(i32)fields.count, EntityState_Resolved)); + array_add(&fields, alloc_entity_field(s, make_token_ident(str_lit("next")), t_int, false, cast(i32)fields.count, EntityState_Resolved)); + array_add(&fields, alloc_entity_field(s, make_token_ident(str_lit("key")), type->Map.key, false, cast(i32)fields.count, EntityState_Resolved)); + array_add(&fields, alloc_entity_field(s, make_token_ident(str_lit("value")), type->Map.value, false, cast(i32)fields.count, EntityState_Resolved)); entry_type->Struct.fields = fields; |