diff options
| author | gingerBill <bill@gingerbill.org> | 2022-03-03 13:56:34 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-03-03 13:56:34 +0000 |
| commit | fcab5508be19ac071a19f392bcd1824e3806af95 (patch) | |
| tree | 770f7a3a85d94d56eae5f69cd4fb7e23d7d63c6d /src/exact_value.cpp | |
| parent | ad6ea3d6aa564ad228cf8883a8fd858135a16030 (diff) | |
| parent | 0b05650366258a56c8da17848e238a21a377afb3 (diff) | |
Merge branch 'master' into odin-ast-changes
Diffstat (limited to 'src/exact_value.cpp')
| -rw-r--r-- | src/exact_value.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/exact_value.cpp b/src/exact_value.cpp index fd90278e5..f6df48951 100644 --- a/src/exact_value.cpp +++ b/src/exact_value.cpp @@ -50,9 +50,9 @@ struct ExactValue { union { bool value_bool; String value_string; - BigInt value_integer; // NOTE(bill): This must be an integer and not a pointer + BigInt value_integer; f64 value_float; - i64 value_pointer; + i64 value_pointer; // NOTE(bill): This must be an integer and not a pointer Complex128 *value_complex; Quaternion256 *value_quaternion; Ast * value_compound; @@ -630,6 +630,9 @@ void match_exact_values(ExactValue *x, ExactValue *y) { case ExactValue_Bool: case ExactValue_String: case ExactValue_Quaternion: + case ExactValue_Pointer: + case ExactValue_Procedure: + case ExactValue_Typeid: return; case ExactValue_Integer: @@ -671,9 +674,6 @@ void match_exact_values(ExactValue *x, ExactValue *y) { return; } break; - - case ExactValue_Procedure: - return; } compiler_error("match_exact_values: How'd you get here? Invalid ExactValueKind %d", x->kind); @@ -932,6 +932,17 @@ bool compare_exact_values(TokenKind op, ExactValue x, ExactValue y) { break; } + case ExactValue_Pointer: { + switch (op) { + case Token_CmpEq: return x.value_pointer == y.value_pointer; + case Token_NotEq: return x.value_pointer != y.value_pointer; + case Token_Lt: return x.value_pointer < y.value_pointer; + case Token_LtEq: return x.value_pointer <= y.value_pointer; + case Token_Gt: return x.value_pointer > y.value_pointer; + case Token_GtEq: return x.value_pointer >= y.value_pointer; + } + } + case ExactValue_Typeid: switch (op) { case Token_CmpEq: return are_types_identical(x.value_typeid, y.value_typeid); |