File tree 1 file changed +10
-7
lines changed
1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -4910,6 +4910,16 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
4910
4910
throw SemanticError("The module '" + mod_sym + "' cannot be loaded",
4911
4911
x.base.base.loc);
4912
4912
}
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
+ }
4913
4923
}
4914
4924
}
4915
4925
@@ -5115,13 +5125,6 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
5115
5125
tmp_vec.clear();
5116
5126
visit_stmt(*x.m_body[i]);
5117
5127
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
-
5125
5128
for (auto t: global_init) {
5126
5129
if (t) {
5127
5130
items.push_back(al, t);
You can’t perform that action at this time.
0 commit comments