Skip to content

Commit 8e39092

Browse files
authored
Merge pull request #6162 from Kelimion/fix-6126
Fix #6126
2 parents 7e39669 + e0ff16f commit 8e39092

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/check_expr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12128,12 +12128,12 @@ gb_internal bool is_exact_value_zero(ExactValue const &v) {
1212812128

1212912129

1213012130

12131-
gb_internal bool compare_exact_values_compound_lit(TokenKind op, ExactValue x, ExactValue y, bool *do_break_) {
12131+
gb_internal bool compare_exact_values_compound_lit(TokenKind op, ExactValue x, ExactValue y) {
1213212132
ast_node(x_cl, CompoundLit, x.value_compound);
1213312133
ast_node(y_cl, CompoundLit, y.value_compound);
1213412134

1213512135
if (x_cl->elems.count != y_cl->elems.count) {
12136-
if (do_break_) *do_break_ = true;
12136+
return false;
1213712137
}
1213812138

1213912139
bool test = op == Token_CmpEq;

src/exact_value.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ gb_internal gb_inline i32 cmp_f64(f64 a, f64 b) {
947947
return (a > b) - (a < b);
948948
}
949949

950-
gb_internal bool compare_exact_values_compound_lit(TokenKind op, ExactValue x, ExactValue y, bool *do_break_);
950+
gb_internal bool compare_exact_values_compound_lit(TokenKind op, ExactValue x, ExactValue y);
951951

952952
gb_internal bool compare_exact_values(TokenKind op, ExactValue x, ExactValue y) {
953953
match_exact_values(&x, &y);
@@ -1060,18 +1060,13 @@ gb_internal bool compare_exact_values(TokenKind op, ExactValue x, ExactValue y)
10601060

10611061
case ExactValue_Compound:
10621062
if (op != Token_CmpEq && op != Token_NotEq) {
1063-
break;
1063+
return false;
10641064
}
10651065

10661066
if (x.kind != y.kind) {
1067-
break;
1067+
return false;
10681068
}
1069-
bool do_break = false;
1070-
bool res = compare_exact_values_compound_lit(op, x, y, &do_break);
1071-
if (do_break) {
1072-
break;
1073-
}
1074-
return res;
1069+
return compare_exact_values_compound_lit(op, x, y);
10751070
}
10761071

10771072
GB_PANIC("Invalid comparison: %d", x.kind);

0 commit comments

Comments
 (0)