Skip to content

Commit fc999f3

Browse files
committed
Fix: Unused imports no longer give unhandled exception
1 parent 22ea159 commit fc999f3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5114,6 +5114,14 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
51145114
tmp = nullptr;
51155115
tmp_vec.clear();
51165116
visit_stmt(*x.m_body[i]);
5117+
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+
51175125
for (auto t: global_init) {
51185126
if (t) {
51195127
items.push_back(al, t);

0 commit comments

Comments
 (0)