Skip to content

Commit cc005db

Browse files
Fix: Restore visit_ImportFrom and remove double registration
1 parent 5b4fdd0 commit cc005db

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4873,6 +4873,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
48734873
}
48744874

48754875
// --- RESTORED visit_ImportFrom ---
4876+
// --- 1. The Missing Function (RESTORE THIS) ---
48764877
void visit_ImportFrom(const AST::ImportFrom_t &x) {
48774878
if (!x.m_module) {
48784879
throw SemanticError("Not implemented: The import statement must currently specify the module name", x.base.base.loc);
@@ -4945,7 +4946,8 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
49454946
}
49464947
tmp = nullptr;
49474948
}
4948-
// --- YOUR FIXED visit_Import ---
4949+
4950+
// --- 2. Your Fixed Function (CORRECT VERSION WITHOUT 'ELSE') ---
49494951
void visit_Import(const AST::Import_t &x) {
49504952
ASR::symbol_t *t = nullptr;
49514953
std::string rl_path = get_runtime_library_dir();
@@ -4988,6 +4990,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
49884990
current_module_dependencies.push_back(al, s2c(al, mod_sym));
49894991
}
49904992

4993+
// ALIAS LOGIC (No else block!)
49914994
if (alias) {
49924995
std::string alias_str = std::string(alias);
49934996
if (current_scope->get_symbol(alias_str) == nullptr) {

0 commit comments

Comments
 (0)