Skip to content

Commit 41210e2

Browse files
committed
Add suggested assert and doc
1 parent 9e1f52b commit 41210e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,8 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
574574
// True for the main module, false for every other one
575575
// The main module is stored directly in TranslationUnit, other modules are Modules
576576
bool main_module;
577+
// This is the current module name that we are compiling from AST to ASR
578+
// It is an empty string for main_module
577579
std::string module_name;
578580
PythonIntrinsicProcedures intrinsic_procedures;
579581
ProceduresDatabase procedures_db;
@@ -3818,6 +3820,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
38183820
void visit_Module(const AST::Module_t &x) {
38193821
ASR::asr_t *tmp0 = nullptr;
38203822
if (current_scope) {
3823+
LCOMPILERS_ASSERT(current_scope->asr_owner);
38213824
tmp0 = current_scope->asr_owner;
38223825
} else {
38233826
current_scope = al.make_new<SymbolTable>(nullptr);
@@ -3827,6 +3830,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
38273830
tmp0 = ASR::make_TranslationUnit_t(al, x.base.base.loc,
38283831
current_scope, nullptr, 0);
38293832
}
3833+
LCOMPILERS_ASSERT(ASR::is_a<ASR::TranslationUnit_t>(*tmp0));
38303834
global_scope = current_scope;
38313835

38323836
ASR::Module_t* module_sym = nullptr;

0 commit comments

Comments
 (0)