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

Skip to content

Commit 88a23f4

Browse files
anutosh491Agent-Hellboy
authored andcommitted
Removed redundant return node after processing an ASR through subroutine_from_function pass
1 parent 8454775 commit 88a23f4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libasr/pass/pass_utils.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,14 @@ namespace LCompilers {
821821
s_func_type->m_arg_types = arg_types.p;
822822
s_func_type->n_arg_types = arg_types.n;
823823
s_func_type->m_return_var_type = nullptr;
824+
825+
Vec<ASR::stmt_t*> func_body;
826+
func_body.reserve(al, x->n_body - 1);
827+
for (size_t i=0; i< x->n_body - 1; i++) {
828+
func_body.push_back(al, x->m_body[i]);
829+
}
830+
x->m_body = func_body.p;
831+
x->n_body = func_body.n;
824832
}
825833
}
826834
for (auto &item : x->m_symtab->get_scope()) {

0 commit comments

Comments
 (0)