aboutsummaryrefslogtreecommitdiff
path: root/src/types.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-07-10 23:15:41 +0100
committerGinger Bill <bill@gingerbill.org>2017-07-10 23:15:41 +0100
commit3868a9a0f00185b6f8f587f67a62cbd12a215336 (patch)
tree70cb3e1b28ace5e2770f4b8747071b3eab24032d /src/types.cpp
parentba5050ac7c2eb116b8989b7d387e67eb79eec62a (diff)
Clean up _preload.odin types
Diffstat (limited to 'src/types.cpp')
-rw-r--r--src/types.cpp31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/types.cpp b/src/types.cpp
index 52a14e352..786c4b13a 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -84,23 +84,13 @@ struct TypeRecord {
// All record types
// Theses are arrays
- // Entity_Variable - struct/raw_union/union (for common fields)
- // Entity_Constant - enum
+ // Entity_Variable - struct/raw_union (for common fields)
Entity **fields;
i32 field_count; // == struct_offsets count
Entity **fields_in_src_order; // Entity_Variable
AstNode *node;
Scope * scope;
- // Entity_TypeName - union
- // Type ** variants;
- // i32 variant_count;
- // Entity * union__tag;
- // i64 variant_block_size; // NOTE(bill): Internal use only
-
- // Type * variant_parent;
- // i32 variant_index;
-
i64 * offsets;
bool are_offsets_set;
bool are_offsets_being_processed;
@@ -109,11 +99,6 @@ struct TypeRecord {
i64 custom_align; // NOTE(bill): Only used in structs at the moment
Entity * names;
-
- // Type * enum_base_type;
- // Entity * enum_count;
- // Entity * enum_min_value;
- // Entity * enum_max_value;
};
#define TYPE_KINDS \
@@ -144,8 +129,6 @@ struct TypeRecord {
Scope * scope; \
Entity * union__tag; \
i64 variant_block_size; \
- Type * variant_parent; \
- i32 variant_index; \
i64 custom_align; \
}) \
TYPE_KIND(Named, struct { \
@@ -1559,14 +1542,24 @@ Selection lookup_field_with_selection(gbAllocator a, Type *type_, String field_n
}
if (is_type) {
- if (type->kind == Type_Record) {
+ switch (type->kind) {
+ case Type_Record:
if (type->Record.names != nullptr &&
field_name == "names") {
sel.entity = type->Record.names;
return sel;
}
+ break;
+ case Type_Enum:
+ if (type->Enum.names != nullptr &&
+ field_name == "names") {
+ sel.entity = type->Enum.names;
+ return sel;
+ }
+ break;
}
+
if (is_type_enum(type)) {
// NOTE(bill): These may not have been added yet, so check in case
if (type->Enum.count != nullptr) {