diff options
| author | gingerBill <bill@gingerbill.org> | 2020-11-23 14:35:31 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-11-23 14:35:31 +0000 |
| commit | 0b30c3dc5ad3f3908719af19e9f7e61daae37706 (patch) | |
| tree | 3f539cada71190a13ccea801a029acc323406325 /src/types.cpp | |
| parent | 9e42cb159543546ca549eeba6c943cf0f4c8410b (diff) | |
Add `flags: Type_Info_Flags,` to `runtime.Type_Info`
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp index 80812e94b..09888f878 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -373,7 +373,28 @@ enum Typeid_Kind : u8 { Typeid_Relative_Slice, }; +// IMPORTANT NOTE(bill): This must match the same as the in core.odin +enum TypeInfoFlag : u32 { + TypeInfoFlag_Comparable = 1<<0, + TypeInfoFlag_Simple_Compare = 1<<1, +}; +bool is_type_comparable(Type *t); +bool is_type_simple_compare(Type *t); + +u32 type_info_flags_of_type(Type *type) { + if (type == nullptr) { + return 0; + } + u32 flags = 0; + if (is_type_comparable(type)) { + flags |= TypeInfoFlag_Comparable; + } + if (is_type_simple_compare(type)) { + flags |= TypeInfoFlag_Comparable; + } + return flags; +} // TODO(bill): Should I add extra information here specifying the kind of selection? @@ -1348,6 +1369,8 @@ bool is_type_simple_compare(Type *t) { return false; } + + Type *base_complex_elem_type(Type *t) { t = core_type(t); if (t->kind == Type_Basic) { |