Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Refactor symbols type 3
  • Loading branch information
Smit-create committed Aug 3, 2023
commit 4b7403b467b207ee413963faaa6d8945b6e1260d
31 changes: 9 additions & 22 deletions src/libasr/pass/unique_symbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ class SymbolRenameVisitor: public ASR::BaseWalkVisitor<SymbolRenameVisitor> {
}
}

void visit_AssociateBlock(const ASR::AssociateBlock_t &x) {
template <typename T>
void visit_symbols_3(T &x) {
if (all_symbols_mangling || should_mangle) {
ASR::symbol_t *sym = ASR::down_cast<ASR::symbol_t>((ASR::asr_t*)&x);
sym_to_renamed[sym] = update_name(x.m_name);
Expand All @@ -173,34 +174,20 @@ class SymbolRenameVisitor: public ASR::BaseWalkVisitor<SymbolRenameVisitor> {
}
}

void visit_AssociateBlock(const ASR::AssociateBlock_t &x) {
visit_symbols_3(x);
}

void visit_Block(const ASR::Block_t &x) {
if (all_symbols_mangling || should_mangle) {
ASR::symbol_t *sym = ASR::down_cast<ASR::symbol_t>((ASR::asr_t*)&x);
sym_to_renamed[sym] = update_name(x.m_name);
}
for (auto &a : x.m_symtab->get_scope()) {
this->visit_symbol(*a.second);
}
visit_symbols_3(x);
}

void visit_Requirement(const ASR::Requirement_t &x) {
if (all_symbols_mangling || should_mangle) {
ASR::symbol_t *sym = ASR::down_cast<ASR::symbol_t>((ASR::asr_t*)&x);
sym_to_renamed[sym] = update_name(x.m_name);
}
for (auto &a : x.m_symtab->get_scope()) {
this->visit_symbol(*a.second);
}
visit_symbols_3(x);
}

void visit_Template(const ASR::Template_t &x) {
if (all_symbols_mangling || should_mangle) {
ASR::symbol_t *sym = ASR::down_cast<ASR::symbol_t>((ASR::asr_t*)&x);
sym_to_renamed[sym] = update_name(x.m_name);
}
for (auto &a : x.m_symtab->get_scope()) {
this->visit_symbol(*a.second);
}
visit_symbols_3(x);
}

};
Expand Down