diff options
| author | DYSEQTA <7029061+DYSEQTA@users.noreply.github.com> | 2021-11-24 12:07:14 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-24 12:07:14 +1100 |
| commit | 0a87ffe0e601d1092034a39ac6365e1a81e3bba1 (patch) | |
| tree | 24e743182d1f379c78154041cbe916d3154f73a0 /src/types.cpp | |
| parent | e5f961b48f52f8346f00d43fea4700c8513c53c3 (diff) | |
| parent | 5db505c42f83d5be628a3e56d6cd471a9e790428 (diff) | |
Merge branch 'odin-lang:master' into master
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/types.cpp b/src/types.cpp index e609815c6..2b7ea93dc 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -697,6 +697,7 @@ Type * bit_set_to_int(Type *t); bool are_types_identical(Type *x, Type *y); bool is_type_pointer(Type *t); +bool is_type_proc(Type *t); bool is_type_slice(Type *t); bool is_type_integer(Type *t); bool type_set_offsets(Type *t); @@ -1284,6 +1285,10 @@ bool is_type_multi_pointer(Type *t) { t = base_type(t); return t->kind == Type_MultiPointer; } +bool is_type_internally_pointer_like(Type *t) { + return is_type_pointer(t) || is_type_multi_pointer(t) || is_type_cstring(t) || is_type_proc(t); +} + bool is_type_tuple(Type *t) { t = base_type(t); return t->kind == Type_Tuple; @@ -4019,7 +4024,13 @@ gbString write_type_to_string(gbString str, Type *type) { case Type_BitSet: str = gb_string_appendc(str, "bit_set["); - str = write_type_to_string(str, type->BitSet.elem); + if (is_type_enum(type->BitSet.elem)) { + str = write_type_to_string(str, type->BitSet.elem); + } else { + str = gb_string_append_fmt(str, "%lld", type->BitSet.lower); + str = gb_string_append_fmt(str, "..="); + str = gb_string_append_fmt(str, "%lld", type->BitSet.upper); + } if (type->BitSet.underlying != nullptr) { str = gb_string_appendc(str, "; "); str = write_type_to_string(str, type->BitSet.underlying); |