File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 11import string
22
33import test_import_08_module
4-
5- # Supporting unused imports that "have expr own variables"
Original file line number Diff line number Diff line change @@ -4910,6 +4910,16 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
49104910 throw SemanticError (" The module '" + mod_sym + " ' cannot be loaded" ,
49114911 x.base .base .loc );
49124912 }
4913+ if ( mod_sym == " __init__" ) {
4914+ for ( auto item: ASRUtils::symbol_symtab (t)->get_scope () ) {
4915+ if ( ASR::is_a<ASR::ExternalSymbol_t>(*item.second ) ) {
4916+ current_module_dependencies.push_back (al,
4917+ ASR::down_cast<ASR::ExternalSymbol_t>(item.second )->m_module_name );
4918+ }
4919+ }
4920+ } else {
4921+ current_module_dependencies.push_back (al, s2c (al, mod_sym));
4922+ }
49134923 }
49144924 }
49154925
@@ -5115,13 +5125,6 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
51155125 tmp_vec.clear ();
51165126 visit_stmt (*x.m_body [i]);
51175127
5118- if (x.m_body [i]->type == LCompilers::LPython::AST::stmtType::Import){
5119- AST::Import_t import = (const AST::Import_t &) *x.m_body [i];
5120- for (size_t j=0 ;j<import .n_names ;j++) {
5121- current_module_dependencies.push_back (al, import .m_names [i].m_name );
5122- }
5123- }
5124-
51255128 for (auto t: global_init) {
51265129 if (t) {
51275130 items.push_back (al, t);
You can’t perform that action at this time.
0 commit comments