From f703df72127f644cdfa9ad0a3fcf73e95a218f5a Mon Sep 17 00:00:00 2001 From: Ron Nuriel Date: Mon, 29 Aug 2022 18:40:46 +0300 Subject: [PATCH] Added binary op and set & op precedence back to 11 (same as the table) Signed-off-by: Ron Nuriel --- integration_tests/CMakeLists.txt | 2 +- src/libasr/codegen/asr_to_c_cpp.h | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index 40f46b2867..434558f63e 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -134,7 +134,7 @@ RUN(NAME expr_01 LABELS cpython llvm c) RUN(NAME expr_02 LABELS cpython llvm c) RUN(NAME expr_03 LABELS cpython llvm c) RUN(NAME expr_04 LABELS cpython llvm c) -RUN(NAME expr_05 LABELS cpython llvm) +RUN(NAME expr_05 LABELS cpython llvm c) RUN(NAME expr_06 LABELS cpython llvm c) RUN(NAME expr_07 LABELS cpython llvm) RUN(NAME expr_08 LABELS llvm c) diff --git a/src/libasr/codegen/asr_to_c_cpp.h b/src/libasr/codegen/asr_to_c_cpp.h index 08e3599246..015ae41f0a 100644 --- a/src/libasr/codegen/asr_to_c_cpp.h +++ b/src/libasr/codegen/asr_to_c_cpp.h @@ -823,7 +823,11 @@ R"(#include case (ASR::binopType::Sub) : { last_expr_precedence = 6; break; } case (ASR::binopType::Mul) : { last_expr_precedence = 5; break; } case (ASR::binopType::Div) : { last_expr_precedence = 5; break; } - case (ASR::binopType::BitAnd) : { last_expr_precedence = 5; break; } + case (ASR::binopType::BitAnd) : { last_expr_precedence = 11; break; } + case (ASR::binopType::BitOr) : { last_expr_precedence = 13; break; } + case (ASR::binopType::BitXor) : { last_expr_precedence = 12; break; } + case (ASR::binopType::BitLShift) : { last_expr_precedence = 7; break; } + case (ASR::binopType::BitRShift) : { last_expr_precedence = 7; break; } case (ASR::binopType::Pow) : { src = "pow(" + left + ", " + right + ")"; if (is_c) {