@@ -338,6 +338,10 @@ class InlineFunctionCallVisitor : public PassUtils::PassVisitor<InlineFunctionCa
338
338
// Duplicate each and every statement of the function body.
339
339
for ( size_t i = 0 ; i < func->n_body && success; i++ ) {
340
340
node_duplicator.success = true ;
341
+ if (ASR::is_a<ASR::BlockCall_t>(*func->m_body [i])
342
+ || ASR::is_a<ASR::GoTo_t>(*func->m_body [i])){
343
+ continue ;
344
+ }
341
345
ASR::stmt_t * m_body_copy = node_duplicator.duplicate_stmt (func->m_body [i]);
342
346
if ( node_duplicator.success ) {
343
347
func_copy.push_back (al, m_body_copy);
@@ -350,7 +354,7 @@ class InlineFunctionCallVisitor : public PassUtils::PassVisitor<InlineFunctionCa
350
354
// Set inlining_function to true so that we inline
351
355
// only one function at a time.
352
356
inlining_function = true ;
353
- for ( size_t i = 0 ; i < func-> n_body && success; i++ ) {
357
+ for ( size_t i = 0 ; i < func_copy. size () && success; i++ ) {
354
358
fixed_duplicated_expr_stmt = true ;
355
359
visit_stmt (*func_copy[i]);
356
360
success = success && fixed_duplicated_expr_stmt;
@@ -373,7 +377,7 @@ class InlineFunctionCallVisitor : public PassUtils::PassVisitor<InlineFunctionCa
373
377
}
374
378
375
379
bool is_goto_added = false ;
376
- for ( size_t i = 0 ; i < func-> n_body ; i++ ) {
380
+ for ( size_t i = 0 ; i < func_copy. size () ; i++ ) {
377
381
return_replacer.current_stmt = &func_copy.p [i];
378
382
return_replacer.has_replacement_happened = false ;
379
383
return_replacer.replace_stmt (func_copy[i]);
0 commit comments