Skip to content

Commit

Permalink
Refactor: Use global_scope directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaikh-Ubaid committed Jul 15, 2023
1 parent b967096 commit ed22f82
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/lpython/semantics/python_ast_to_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4470,20 +4470,16 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
ASR::symbol_t *t = nullptr; // current_scope->parent->resolve_symbol(msym);
if (!t) {
std::string rl_path = get_runtime_library_dir();
SymbolTable *st = current_scope;
std::vector<std::string> paths;
for (auto &path:import_paths) {
paths.push_back(path);
}
paths.push_back(rl_path);
paths.push_back(parent_dir);

if (!main_module) {
st = st->parent;
}
bool lpython, enum_py, copy, sympy;
set_module_symbol(msym, paths);
t = (ASR::symbol_t*)(load_module(al, st,
t = (ASR::symbol_t*)(load_module(al, global_scope,
msym, x.base.base.loc, diag, lm, false, paths, lpython, enum_py, copy, sympy,
[&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); },
allow_implicit_casting));
Expand Down Expand Up @@ -4547,18 +4543,14 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
}
paths.push_back(rl_path);
paths.push_back(parent_dir);
SymbolTable *st = current_scope;
std::vector<std::string> mods;
for (size_t i=0; i<x.n_names; i++) {
mods.push_back(x.m_names[i].m_name);
}
if (!main_module) {
st = st->parent;
}
for (auto &mod_sym : mods) {
bool lpython, enum_py, copy, sympy;
set_module_symbol(mod_sym, paths);
t = (ASR::symbol_t*)(load_module(al, st,
t = (ASR::symbol_t*)(load_module(al, global_scope,
mod_sym, x.base.base.loc, diag, lm, false, paths, lpython, enum_py, copy, sympy,
[&](const std::string &msg, const Location &loc) { throw SemanticError(msg, loc); },
allow_implicit_casting));
Expand Down

0 comments on commit ed22f82

Please sign in to comment.