aboutsummaryrefslogtreecommitdiff
path: root/core
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 /core
parent1553137c2365c3980488a6455fd83f0fcb9e28ca (diff)
Rename `#partial[Enum]Type` to `#sparse[Enum]Type` for non-contiguous enum fields
Diffstat (limited to 'core')
-rw-r--r--core/reflect/types.odin3
-rw-r--r--core/runtime/core.odin1
-rw-r--r--core/runtime/print.odin3
3 files changed, 7 insertions, 0 deletions
diff --git a/core/reflect/types.odin b/core/reflect/types.odin
index 74778013a..a9a4a8d48 100644
--- a/core/reflect/types.odin
+++ b/core/reflect/types.odin
@@ -472,6 +472,9 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info, n_written: ^int = nil) -
write_type(w, info.elem, &n) or_return
case Type_Info_Enumerated_Array:
+ if info.is_sparse {
+ io.write_string(w, "#sparse", &n) or_return
+ }
io.write_string(w, "[", &n) or_return
write_type(w, info.index, &n) or_return
io.write_string(w, "]", &n) or_return
diff --git a/core/runtime/core.odin b/core/runtime/core.odin
index 424650828..35144473b 100644
--- a/core/runtime/core.odin
+++ b/core/runtime/core.odin
@@ -95,6 +95,7 @@ Type_Info_Enumerated_Array :: struct {
count: int,
min_value: Type_Info_Enum_Value,
max_value: Type_Info_Enum_Value,
+ is_sparse: bool,
}
Type_Info_Dynamic_Array :: struct {elem: ^Type_Info, elem_size: int}
Type_Info_Slice :: struct {elem: ^Type_Info, elem_size: int}
diff --git a/core/runtime/print.odin b/core/runtime/print.odin
index 8c0b65864..06740bc75 100644
--- a/core/runtime/print.odin
+++ b/core/runtime/print.odin
@@ -260,6 +260,9 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
print_type(info.elem)
case Type_Info_Enumerated_Array:
+ if info.is_sparse {
+ print_string("#sparse")
+ }
print_byte('[')
print_type(info.index)
print_byte(']')