aboutsummaryrefslogtreecommitdiff
path: root/src/types.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-02-05 13:01:15 +0000
committergingerBill <bill@gingerbill.org>2022-02-05 13:01:15 +0000
commit97be86710306702a672309b23fbe8d38f1e6eeec (patch)
treeb8794b78149da6ec960250a1597073c6f7ec250f /src/types.cpp
parent1553137c2365c3980488a6455fd83f0fcb9e28ca (diff)
Rename `#partial[Enum]Type` to `#sparse[Enum]Type` for non-contiguous enum fields
Diffstat (limited to 'src/types.cpp')
-rw-r--r--src/types.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp
index 07951196a..e0d35a12c 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -221,6 +221,7 @@ struct TypeProc {
ExactValue *max_value; \
i64 count; \
TokenKind op; \
+ bool is_sparse; \
}) \
TYPE_KIND(Slice, struct { Type *elem; }) \
TYPE_KIND(DynamicArray, struct { Type *elem; }) \
@@ -3830,6 +3831,9 @@ gbString write_type_to_string(gbString str, Type *type) {
break;
case Type_EnumeratedArray:
+ if (type->EnumeratedArray.is_sparse) {
+ str = gb_string_appendc(str, "#sparse");
+ }
str = gb_string_append_rune(str, '[');
str = write_type_to_string(str, type->EnumeratedArray.index);
str = gb_string_append_rune(str, ']');