Skip to content

Commit 8472ea4

Browse files
committed
Import only once
1 parent 6d08cff commit 8472ea4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5905,9 +5905,12 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
59055905
std::string call_name_store = "__" + value + "_" + call_name;
59065906
ASR::Module_t *m = ASR::down_cast<ASR::Module_t>(t);
59075907
call_name_store = ASRUtils::get_mangled_name(m, call_name_store);
5908-
ASR::symbol_t *st = import_from_module(al, m, current_scope, value,
5908+
ASR::symbol_t *st = current_scope->resolve_symbol(call_name_store);
5909+
if (!st) {
5910+
st = import_from_module(al, m, current_scope, value,
59095911
call_name, call_name_store, x.base.base.loc);
5910-
current_scope->add_symbol(call_name_store, st);
5912+
current_scope->add_symbol(call_name_store, st);
5913+
}
59115914
Vec<ASR::call_arg_t> args;
59125915
args.reserve(al, c->n_args);
59135916
visit_expr_list(c->m_args, c->n_args, args);

0 commit comments

Comments
 (0)