Skip to content

Commit

Permalink
Merge pull request lcompilers#1570 from anutosh491/branch08
Browse files Browse the repository at this point in the history
  • Loading branch information
czgdp1807 committed Mar 10, 2023
2 parents 4704837 + d88912c commit ffdd221
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ RUN(NAME loop_01 LABELS cpython llvm c)
RUN(NAME loop_02 LABELS cpython llvm c wasm wasm_x86 wasm_x64)
RUN(NAME loop_03 LABELS cpython llvm c wasm wasm_x64)
RUN(NAME loop_04 LABELS cpython llvm)
RUN(NAME loop_05 LABELS cpython llvm c)
RUN(NAME if_01 LABELS cpython llvm c wasm wasm_x86 wasm_x64)
RUN(NAME if_02 LABELS cpython llvm c wasm wasm_x86 wasm_x64)
RUN(NAME print_02 LABELS cpython llvm c)
Expand Down
11 changes: 11 additions & 0 deletions integration_tests/loop_05.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def f():
j :i32 = 0
while True:
j = j + 1
print(j)
if j > 4:
break
print("out of outer loop")
assert j == 5

f()
6 changes: 6 additions & 0 deletions src/libasr/pass/pass_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ namespace LCompilers {
transform_stmts(xx.m_body, xx.n_body);
}

void visit_WhileLoop(const ASR::WhileLoop_t& x) {
ASR::WhileLoop_t& xx = const_cast<ASR::WhileLoop_t&>(x);
self().visit_expr(*xx.m_test);
transform_stmts(xx.m_body, xx.n_body);
}

void visit_If(const ASR::If_t& x) {
ASR::If_t &xx = const_cast<ASR::If_t&>(x);
self().visit_expr(*xx.m_test);
Expand Down

0 comments on commit ffdd221

Please sign in to comment.