Add array programming

This commit is contained in:
gingerBill
2017-11-05 14:22:18 +00:00
parent 04b917a60a
commit 1d4881cbbe
5 changed files with 203 additions and 64 deletions

View File

@@ -662,6 +662,11 @@ bool is_type_numeric(Type *t) {
if (t->kind == Type_Vector) {
return is_type_numeric(t->Vector.elem);
}
#if defined(ALLOW_ARRAY_PROGRAMMING)
if (t->kind == Type_Array) {
return is_type_numeric(t->Array.elem);
}
#endif
return false;
}
bool is_type_string(Type *t) {
@@ -810,6 +815,13 @@ Type *base_vector_type(Type *t) {
}
return t;
}
Type *base_array_type(Type *t) {
if (is_type_array(t)) {
t = base_type(t);
return t->Array.elem;
}
return t;
}
Type *base_complex_elem_type(Type *t) {
t = core_type(t);
@@ -1067,7 +1079,7 @@ bool is_type_comparable(Type *t) {
case Type_Enum:
return is_type_comparable(core_type(t));
case Type_Array:
return false;
return is_type_comparable(t->Array.elem);
case Type_Vector:
return is_type_comparable(t->Vector.elem);
case Type_Proc: