Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/lpython/semantics/python_ast_to_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6731,6 +6731,16 @@ Result<ASR::TranslationUnit_t*> python_ast_to_asr(Allocator &al, LocationManager
throw LCompilersException("Verify failed");
};
#endif
if (compiler_options.disable_main) {
// TODO: the main program should have not been created, but sometimes
// it is, so we explicitly remove it here.
for (auto &item : tu->m_global_scope->get_scope()) {
if (ASR::is_a<ASR::Program_t>(*item.second)) {
tu->m_global_scope->erase_symbol(item.first);
break;
}
}
}
}

return tu;
Expand Down