aboutsummaryrefslogtreecommitdiff
path: root/src/types.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-06-28 11:32:23 +0100
committergingerBill <bill@gingerbill.org>2021-06-28 11:32:23 +0100
commit8d31ba492df26eaae73bda37349408a10ff17798 (patch)
tree0570beea510060effe934c5b6fd507c2116f3c90 /src/types.cpp
parent8f611b33991eafd405652986e0df746e946ed9d5 (diff)
Fix #1042
Diffstat (limited to 'src/types.cpp')
-rw-r--r--src/types.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp
index 7f22d0202..5f6fdbb34 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -1262,6 +1262,20 @@ bool is_type_rune_array(Type *t) {
}
+bool is_type_array_like(Type *t) {
+ return is_type_array(t) || is_type_enumerated_array(t);
+}
+i64 get_array_type_count(Type *t) {
+ Type *bt = base_type(t);
+ if (bt->kind == Type_Array) {
+ return bt->Array.count;
+ } else if (bt->kind == Type_EnumeratedArray) {
+ return bt->EnumeratedArray.count;
+ }
+ GB_ASSERT(is_type_array_like(t));
+ return -1;
+}
+
Type *core_array_type(Type *t) {