Skip to content

Commit 9559ab4

Browse files
committed
Set is_dict_present=false when entering a scope and reset when leaving
1 parent bd81ce6 commit 9559ab4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libasr/codegen/asr_to_llvm.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
17561756
}
17571757

17581758
void visit_Program(const ASR::Program_t &x) {
1759+
bool is_dict_present_copy = dict_api->is_dict_present;
1760+
dict_api->is_dict_present = false;
17591761
llvm_goto_targets.clear();
17601762
// Generate code for nested subroutines and functions first:
17611763
for (auto &item : x.m_symtab->get_scope()) {
@@ -1784,6 +1786,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
17841786
llvm::Value *ret_val2 = llvm::ConstantInt::get(context,
17851787
llvm::APInt(32, 0));
17861788
builder->CreateRet(ret_val2);
1789+
dict_api->is_dict_present = is_dict_present_copy;
17871790
}
17881791

17891792
/*
@@ -2586,6 +2589,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
25862589
}
25872590

25882591
void visit_Function(const ASR::Function_t &x) {
2592+
bool is_dict_present_copy = dict_api->is_dict_present;
2593+
dict_api->is_dict_present = false;
25892594
llvm_goto_targets.clear();
25902595
instantiate_function(x);
25912596
if (x.m_deftype == ASR::deftypeType::Interface) {
@@ -2596,6 +2601,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
25962601
visit_procedures(x);
25972602
generate_function(x);
25982603
parent_function = nullptr;
2604+
dict_api->is_dict_present = is_dict_present_copy;
25992605
}
26002606

26012607
void instantiate_function(const ASR::Function_t &x){

0 commit comments

Comments
 (0)