diff options
| author | gingerBill <bill@gingerbill.org> | 2017-11-05 14:22:18 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-11-05 14:22:18 +0000 |
| commit | 1d4881cbbe0da6c5f9cd4a99dd1bf65c5e00c51d (patch) | |
| tree | 1a7b816d1141a98656a76d04b237d0f898db7c5f /src/types.cpp | |
| parent | 04b917a60aef2b60c6580899d191913004dbb2af (diff) | |
Add array programming
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/types.cpp b/src/types.cpp index 09fcc98b7..364023d7e 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -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: |