diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-12-15 10:41:50 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-12-15 10:41:50 +0000 |
| commit | c5a54a0e525b27f67b893253d50751d952d1cb86 (patch) | |
| tree | 958def032082c390f4b3aadae2c116103ccebc45 /src/exact_value.cpp | |
| parent | aed11c46192a3634afb43bdcc7514464f99a77b9 (diff) | |
Do naive compound literal comparison for $ parameters to parapoly procedures
Diffstat (limited to 'src/exact_value.cpp')
| -rw-r--r-- | src/exact_value.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/exact_value.cpp b/src/exact_value.cpp index e7077bd5b..f266b8b24 100644 --- a/src/exact_value.cpp +++ b/src/exact_value.cpp @@ -947,6 +947,8 @@ gb_internal gb_inline i32 cmp_f64(f64 a, f64 b) { return (a > b) - (a < b); } +gb_internal bool compare_exact_values_compound_lit(TokenKind op, ExactValue x, ExactValue y, bool *do_break_); + gb_internal bool compare_exact_values(TokenKind op, ExactValue x, ExactValue y) { match_exact_values(&x, &y); @@ -1055,9 +1057,24 @@ gb_internal bool compare_exact_values(TokenKind op, ExactValue x, ExactValue y) case Token_NotEq: return x.value_typeid != y.value_typeid; } break; + + case ExactValue_Compound: + if (op != Token_CmpEq && op != Token_NotEq) { + break; + } + + if (x.kind != y.kind) { + break; + } + bool do_break = false; + bool res = compare_exact_values_compound_lit(op, x, y, &do_break); + if (do_break) { + break; + } + return res; } - GB_PANIC("Invalid comparison"); + GB_PANIC("Invalid comparison: %d", x.kind); return false; } |