Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2912bb8

Browse files
committed
Added visit_WhileLoop
1 parent 9c7898d commit 2912bb8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libasr/pass/replace_symbolic.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,18 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi
974974
}
975975
}
976976

977+
void visit_WhileLoop(const ASR::WhileLoop_t &x) {
978+
ASR::WhileLoop_t &xx = const_cast<ASR::WhileLoop_t&>(x);
979+
transform_stmts(xx.m_body, xx.n_body);
980+
if (ASR::is_a<ASR::IntrinsicScalarFunction_t>(*xx.m_test)) {
981+
ASR::IntrinsicScalarFunction_t* intrinsic_func = ASR::down_cast<ASR::IntrinsicScalarFunction_t>(xx.m_test);
982+
if (intrinsic_func->m_type->type == ASR::ttypeType::Logical) {
983+
ASR::expr_t* function_call = process_attributes(xx.base.base.loc, xx.m_test);
984+
xx.m_test = function_call;
985+
}
986+
}
987+
}
988+
977989
void visit_Return(const ASR::Return_t &x) {
978990
if (!symbolic_vars_to_free.empty()){
979991
for (ASR::symbol_t* symbol : symbolic_vars_to_free) {

0 commit comments

Comments
 (0)