aboutsummaryrefslogtreecommitdiff
path: root/src/checker/type.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-09-08 18:28:18 +0100
committerGinger Bill <bill@gingerbill.org>2016-09-08 18:28:18 +0100
commit56dd12c54c20b2e4a7f896999ece1cf184f09e88 (patch)
tree64947563e064550cef3ecdc26bd9b36bb05b48a3 /src/checker/type.cpp
parentc6d02e4778486c350a732105b6413ba1d32a234a (diff)
Fix match statements for the new AstNodeArray type
Diffstat (limited to 'src/checker/type.cpp')
-rw-r--r--src/checker/type.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/checker/type.cpp b/src/checker/type.cpp
index f2db752a0..53944d3d6 100644
--- a/src/checker/type.cpp
+++ b/src/checker/type.cpp
@@ -706,8 +706,8 @@ void selection_add_index(Selection *s, isize index) {
gb_array_append(s->index, index);
}
-gb_global Entity *entity_any_type_info = NULL;
-gb_global Entity *entity_any_data = NULL;
+gb_global Entity *entity__any_type_info = NULL;
+gb_global Entity *entity__any_data = NULL;
Selection lookup_field(Type *type_, String field_name, b32 is_type, Selection sel = empty_selection) {
GB_ASSERT(type_ != NULL);
@@ -721,29 +721,31 @@ Selection lookup_field(Type *type_, String field_name, b32 is_type, Selection se
type = get_base_type(type);
if (type->kind == Type_Basic) {
- if (type->Basic.kind == Basic_any) {
+ switch (type->Basic.kind) {
+ case Basic_any: {
String type_info_str = make_string("type_info");
String data_str = make_string("data");
- if (entity_any_type_info == NULL) {
+ if (entity__any_type_info == NULL) {
Token token = {Token_Identifier};
token.string = type_info_str;
- entity_any_type_info = make_entity_field(gb_heap_allocator(), NULL, token, t_type_info_ptr, false);
+ entity__any_type_info = make_entity_field(gb_heap_allocator(), NULL, token, t_type_info_ptr, false);
}
- if (entity_any_data == NULL) {
+ if (entity__any_data == NULL) {
Token token = {Token_Identifier};
token.string = data_str;
- entity_any_data = make_entity_field(gb_heap_allocator(), NULL, token, t_type_info_ptr, false);
+ entity__any_data = make_entity_field(gb_heap_allocator(), NULL, token, t_rawptr, false);
}
if (are_strings_equal(field_name, type_info_str)) {
selection_add_index(&sel, 0);
- sel.entity = entity_any_type_info;
+ sel.entity = entity__any_type_info;
return sel;
} else if (are_strings_equal(field_name, data_str)) {
selection_add_index(&sel, 1);
- sel.entity = entity_any_data;
+ sel.entity = entity__any_data;
return sel;
}
+ } break;
}
return sel;
@@ -916,8 +918,11 @@ i64 type_size_of(BaseTypeSizes s, gbAllocator allocator, Type *t) {
if (size > 0)
return size;
}
- if (kind == Basic_string)
+ if (kind == Basic_string) {
return 2 * s.word_size;
+ } else if (kind == Basic_any) {
+ return 2 * s.word_size;
+ }
} break;
case Type_Array: {