aboutsummaryrefslogtreecommitdiff
path: root/src/checker/type.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-09-29 00:42:26 +0100
committerGinger Bill <bill@gingerbill.org>2016-09-29 00:42:26 +0100
commit04b5d8c132e8aabb3bb5dff31683cb45d4dff9c0 (patch)
treee8a13d736022bd50e85f324eb5186d1ca00f0ea1 /src/checker/type.cpp
parent6e39a42c8a090d6e32231872cc292c90de6b304e (diff)
using on indexable field; Auto deref for (Index|Slice)Expr
Diffstat (limited to 'src/checker/type.cpp')
-rw-r--r--src/checker/type.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/checker/type.cpp b/src/checker/type.cpp
index 34a18a6da..dded3826e 100644
--- a/src/checker/type.cpp
+++ b/src/checker/type.cpp
@@ -487,6 +487,10 @@ b32 is_type_u8(Type *t) {
}
return false;
}
+b32 is_type_array(Type *t) {
+ t = base_type(t);
+ return t->kind == Type_Array;
+}
b32 is_type_slice(Type *t) {
t = base_type(t);
return t->kind == Type_Slice;
@@ -546,6 +550,11 @@ b32 is_type_any(Type *t) {
}
+b32 is_type_indexable(Type *t) {
+ return is_type_array(t) || is_type_slice(t) || is_type_vector(t) || is_type_string(t);
+}
+
+
b32 is_type_comparable(Type *t) {
t = base_type(t);