| author | |
| committer | |
| log | 0827a8f36bd0b99b876586b8c7ee099fbc903535 |
| tree | 660fe754ecda2e6d57b6cbc63f8edbd71f96ed1c |
| parent | 4c8443d96db4a441b393ea0c3c8d76a7493f46d0 |
2 files changed, 17 insertions(+), 2 deletions(-)
src/parsec.cpp+1-2| ... | ... | @@ -978,8 +978,7 @@ static AstNode *trans_binary_operator(Context *c, bool result_used, AstNode *blo |
| 978 | 978 | case BO_EQ: |
| 979 | 979 | return trans_create_bin_op(c, block, stmt->getLHS(), BinOpTypeCmpEq, stmt->getRHS()); |
| 980 | 980 | case BO_NE: |
| 981 | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: BO_NE"); | |
| 982 | return nullptr; | |
| 981 | return trans_create_bin_op(c, block, stmt->getLHS(), BinOpTypeCmpNotEq, stmt->getRHS()); | |
| 983 | 982 | case BO_And: |
| 984 | 983 | emit_warning(c, stmt->getLocStart(), "TODO handle more C binary operators: BO_And"); |
| 985 | 984 | return nullptr; |
test/parsec.zig+16| ... | ... | @@ -373,6 +373,22 @@ pub fn addCases(cases: &tests.ParseCContext) { |
| 373 | 373 | \\} |
| 374 | 374 | ); |
| 375 | 375 | |
| 376 | cases.add("==, !=", | |
| 377 | \\int max(int a, int b) { | |
| 378 | \\ if (a == b) | |
| 379 | \\ return a; | |
| 380 | \\ if (a != b) | |
| 381 | \\ return b; | |
| 382 | \\ return a; | |
| 383 | \\} | |
| 384 | , | |
| 385 | \\export fn max(a: c_int, b: c_int) -> c_int { | |
| 386 | \\ if (a == b) return a; | |
| 387 | \\ if (a != b) return b; | |
| 388 | \\ return a; | |
| 389 | \\} | |
| 390 | ); | |
| 391 | ||
| 376 | 392 | cases.add("logical and, logical or", |
| 377 | 393 | \\int max(int a, int b) { |
| 378 | 394 | \\ if (a < b || a == b) |