@@ -341,9 +341,15 @@ namespace LCompilers {
341
341
SymbolTable* temp_scope = current_scope;
342
342
343
343
if (asr_owner_sym && temp_scope->get_counter () != ASRUtils::symbol_parent_symtab (x.m_name )->get_counter () &&
344
- !ASR::is_a<ASR::AssociateBlock_t>(*asr_owner_sym) && !ASR::is_a<ASR::ExternalSymbol_t>(*x.m_name ) &&
345
- !ASR::is_a<ASR::Variable_t>(*x.m_name )) {
346
- function_dependencies.push_back (al, ASRUtils::symbol_name (x.m_name ));
344
+ !ASR::is_a<ASR::ExternalSymbol_t>(*x.m_name ) && !ASR::is_a<ASR::Variable_t>(*x.m_name )) {
345
+ if (ASR::is_a<ASR::AssociateBlock_t>(*asr_owner_sym) || ASR::is_a<ASR::Block_t>(*asr_owner_sym)) {
346
+ temp_scope = temp_scope->parent ;
347
+ if (temp_scope->get_counter () != ASRUtils::symbol_parent_symtab (x.m_name )->get_counter ()) {
348
+ function_dependencies.push_back (al, ASRUtils::symbol_name (x.m_name ));
349
+ }
350
+ } else {
351
+ function_dependencies.push_back (al, ASRUtils::symbol_name (x.m_name ));
352
+ }
347
353
}
348
354
}
349
355
@@ -367,9 +373,15 @@ namespace LCompilers {
367
373
SymbolTable* temp_scope = current_scope;
368
374
369
375
if (asr_owner_sym && temp_scope->get_counter () != ASRUtils::symbol_parent_symtab (x.m_name )->get_counter () &&
370
- !ASR::is_a<ASR::AssociateBlock_t>(*asr_owner_sym) && !ASR::is_a<ASR::ExternalSymbol_t>(*x.m_name ) &&
371
- !ASR::is_a<ASR::Variable_t>(*x.m_name )) {
372
- function_dependencies.push_back (al, ASRUtils::symbol_name (x.m_name ));
376
+ !ASR::is_a<ASR::ExternalSymbol_t>(*x.m_name ) && !ASR::is_a<ASR::Variable_t>(*x.m_name )) {
377
+ if (ASR::is_a<ASR::AssociateBlock_t>(*asr_owner_sym) || ASR::is_a<ASR::Block_t>(*asr_owner_sym)) {
378
+ temp_scope = temp_scope->parent ;
379
+ if (temp_scope->get_counter () != ASRUtils::symbol_parent_symtab (x.m_name )->get_counter ()) {
380
+ function_dependencies.push_back (al, ASRUtils::symbol_name (x.m_name ));
381
+ }
382
+ } else {
383
+ function_dependencies.push_back (al, ASRUtils::symbol_name (x.m_name ));
384
+ }
373
385
}
374
386
}
375
387
@@ -384,10 +396,13 @@ namespace LCompilers {
384
396
}
385
397
386
398
void visit_BlockCall (const ASR::BlockCall_t& x) {
399
+ SymbolTable *parent_symtab = current_scope;
387
400
ASR::Block_t* block = ASR::down_cast<ASR::Block_t>(x.m_m );
401
+ current_scope = block->m_symtab ;
388
402
for (size_t i=0 ; i<block->n_body ; i++) {
389
403
visit_stmt (*(block->m_body [i]));
390
404
}
405
+ current_scope = parent_symtab;
391
406
}
392
407
393
408
void visit_AssociateBlock (const ASR::AssociateBlock_t& x) {
0 commit comments