diff options
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/types.cpp b/src/types.cpp index 4b3ce2edd..62db34a60 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1839,13 +1839,26 @@ Selection lookup_field_with_selection(Type *type_, String field_name, bool is_ty // `Raw_Dynamic_Array` type? GB_ASSERT(t_allocator != nullptr); String allocator_str = str_lit("allocator"); - gb_local_persist Entity *entity__allocator = alloc_entity_field(nullptr, make_token_ident(allocator_str), t_allocator, false, 0); + gb_local_persist Entity *entity__allocator = alloc_entity_field(nullptr, make_token_ident(allocator_str), t_allocator, false, 3); if (field_name == allocator_str) { selection_add_index(&sel, 3); sel.entity = entity__allocator; return sel; } + } else if (type->kind == Type_Map) { + // IMPORTANT TODO(bill): Should these members be available to should I only allow them with + // `Raw_Map` type? + GB_ASSERT(t_allocator != nullptr); + String allocator_str = str_lit("allocator"); + gb_local_persist Entity *entity__allocator = alloc_entity_field(nullptr, make_token_ident(allocator_str), t_allocator, false, 3); + + if (field_name == allocator_str) { + selection_add_index(&sel, 1); + selection_add_index(&sel, 3); + sel.entity = entity__allocator; + return sel; + } } return sel; |