@@ -441,15 +441,15 @@ class VerifyVisitor : public BaseWalkVisitor<VerifyVisitor>
441
441
verify_unique_dependencies (x.m_dependencies , x.n_dependencies ,
442
442
x.m_name , x.base .base .loc );
443
443
444
- // Get the x symtab.
445
- SymbolTable *x_symtab = x.m_symtab ;
444
+ // Get the x parent symtab.
445
+ SymbolTable *x_parent_symtab = x.m_symtab -> parent ;
446
446
447
447
// Dependencies of the function should be from function's parent symbol table.
448
448
for ( size_t i = 0 ; i < x.n_dependencies ; i++ ) {
449
449
std::string found_dep = x.m_dependencies [i];
450
450
451
451
// Get the symbol of the found_dep.
452
- ASR::symbol_t * dep_sym = x_symtab ->resolve_symbol (found_dep);
452
+ ASR::symbol_t * dep_sym = x_parent_symtab ->resolve_symbol (found_dep);
453
453
454
454
require (dep_sym != nullptr ,
455
455
" Dependency " + found_dep + " is inside symbol table " + std::string (x.m_name ));
@@ -891,10 +891,16 @@ class VerifyVisitor : public BaseWalkVisitor<VerifyVisitor>
891
891
892
892
SymbolTable* temp_scope = current_symtab;
893
893
894
- if (temp_scope->get_counter () != ASRUtils::symbol_parent_symtab (x.m_name )->get_counter () &&
895
- !ASR::is_a<ASR::AssociateBlock_t>(*asr_owner_sym) && !ASR::is_a<ASR::ExternalSymbol_t>(*x.m_name ) &&
896
- !ASR::is_a<ASR::Variable_t>(*x.m_name )) {
897
- function_dependencies.push_back (std::string (ASRUtils::symbol_name (x.m_name )));
894
+ if (asr_owner_sym && temp_scope->get_counter () != ASRUtils::symbol_parent_symtab (x.m_name )->get_counter () &&
895
+ !ASR::is_a<ASR::ExternalSymbol_t>(*x.m_name ) && !ASR::is_a<ASR::Variable_t>(*x.m_name )) {
896
+ if (ASR::is_a<ASR::AssociateBlock_t>(*asr_owner_sym) || ASR::is_a<ASR::Block_t>(*asr_owner_sym)) {
897
+ temp_scope = temp_scope->parent ;
898
+ if (temp_scope->get_counter () != ASRUtils::symbol_parent_symtab (x.m_name )->get_counter ()) {
899
+ function_dependencies.push_back (std::string (ASRUtils::symbol_name (x.m_name )));
900
+ }
901
+ } else {
902
+ function_dependencies.push_back (std::string (ASRUtils::symbol_name (x.m_name )));
903
+ }
898
904
}
899
905
900
906
if ( ASR::is_a<ASR::ExternalSymbol_t>(*x.m_name ) ) {
@@ -1037,9 +1043,15 @@ class VerifyVisitor : public BaseWalkVisitor<VerifyVisitor>
1037
1043
SymbolTable* temp_scope = current_symtab;
1038
1044
1039
1045
if (asr_owner_sym && temp_scope->get_counter () != ASRUtils::symbol_parent_symtab (x.m_name )->get_counter () &&
1040
- !ASR::is_a<ASR::AssociateBlock_t>(*asr_owner_sym) && !ASR::is_a<ASR::ExternalSymbol_t>(*x.m_name ) &&
1041
- !ASR::is_a<ASR::Variable_t>(*x.m_name )) {
1042
- function_dependencies.push_back (std::string (ASRUtils::symbol_name (x.m_name )));
1046
+ !ASR::is_a<ASR::ExternalSymbol_t>(*x.m_name ) && !ASR::is_a<ASR::Variable_t>(*x.m_name )) {
1047
+ if (ASR::is_a<ASR::AssociateBlock_t>(*asr_owner_sym) || ASR::is_a<ASR::Block_t>(*asr_owner_sym)) {
1048
+ temp_scope = temp_scope->parent ;
1049
+ if (temp_scope->get_counter () != ASRUtils::symbol_parent_symtab (x.m_name )->get_counter ()) {
1050
+ function_dependencies.push_back (std::string (ASRUtils::symbol_name (x.m_name )));
1051
+ }
1052
+ } else {
1053
+ function_dependencies.push_back (std::string (ASRUtils::symbol_name (x.m_name )));
1054
+ }
1043
1055
}
1044
1056
1045
1057
if ( ASR::is_a<ASR::ExternalSymbol_t>(*x.m_name ) ) {
0 commit comments