@@ -4470,20 +4470,16 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
44704470 ASR::symbol_t *t = nullptr ; // current_scope->parent->resolve_symbol(msym);
44714471 if (!t) {
44724472 std::string rl_path = get_runtime_library_dir ();
4473- SymbolTable *st = current_scope;
44744473 std::vector<std::string> paths;
44754474 for (auto &path:import_paths) {
44764475 paths.push_back (path);
44774476 }
44784477 paths.push_back (rl_path);
44794478 paths.push_back (parent_dir);
44804479
4481- if (!main_module) {
4482- st = st->parent ;
4483- }
44844480 bool lpython, enum_py, copy, sympy;
44854481 set_module_symbol (msym, paths);
4486- t = (ASR::symbol_t *)(load_module (al, st ,
4482+ t = (ASR::symbol_t *)(load_module (al, global_scope ,
44874483 msym, x.base .base .loc , diag, lm, false , paths, lpython, enum_py, copy, sympy,
44884484 [&](const std::string &msg, const Location &loc) { throw SemanticError (msg, loc); },
44894485 allow_implicit_casting));
@@ -4547,18 +4543,14 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
45474543 }
45484544 paths.push_back (rl_path);
45494545 paths.push_back (parent_dir);
4550- SymbolTable *st = current_scope;
45514546 std::vector<std::string> mods;
45524547 for (size_t i=0 ; i<x.n_names ; i++) {
45534548 mods.push_back (x.m_names [i].m_name );
45544549 }
4555- if (!main_module) {
4556- st = st->parent ;
4557- }
45584550 for (auto &mod_sym : mods) {
45594551 bool lpython, enum_py, copy, sympy;
45604552 set_module_symbol (mod_sym, paths);
4561- t = (ASR::symbol_t *)(load_module (al, st ,
4553+ t = (ASR::symbol_t *)(load_module (al, global_scope ,
45624554 mod_sym, x.base .base .loc , diag, lm, false , paths, lpython, enum_py, copy, sympy,
45634555 [&](const std::string &msg, const Location &loc) { throw SemanticError (msg, loc); },
45644556 allow_implicit_casting));
0 commit comments