Skip to content

Commit

Permalink
Use shorter names for global_init() and global_stmts()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaikh-Ubaid committed Aug 2, 2023
1 parent 6c72dca commit 7ff545d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lpython/semantics/python_ast_to_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ void get_calls_to_global_init_and_stmts(Allocator &al, const Location &loc, Symb
ASR::Module_t* mod, std::vector<ASR::asr_t *> &tmp_vec) {

std::string mod_name = mod->m_name;
std::string g_func_name = mod_name + "__global_initializer";
std::string g_func_name = mod_name + "global_init";
ASR::symbol_t *g_func = mod->m_symtab->get_symbol(g_func_name);
if (g_func && !scope->get_symbol(g_func_name)) {
ASR::symbol_t *es = ASR::down_cast<ASR::symbol_t>(
Expand All @@ -441,7 +441,7 @@ void get_calls_to_global_init_and_stmts(Allocator &al, const Location &loc, Symb
es, g_func, nullptr, 0, nullptr, nullptr, false));
}

g_func_name = mod_name + "__global_statements";
g_func_name = mod_name + "global_stmts";
g_func = mod->m_symtab->get_symbol(g_func_name);
if (g_func && !scope->get_symbol(g_func_name)) {
ASR::symbol_t *es = ASR::down_cast<ASR::symbol_t>(
Expand Down Expand Up @@ -4803,7 +4803,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
// `pass_wrap_global_stmts_into_function` pass
unit->m_items = global_init.p;
unit->n_items = global_init.size();
std::string func_name = module_name + "__global_initializer";
std::string func_name = module_name + "global_init";
LCompilers::PassOptions pass_options;
pass_options.run_fun = func_name;
pass_wrap_global_stmts(al, *unit, pass_options);
Expand All @@ -4826,7 +4826,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
if (items.n > 0) {
unit->m_items = items.p;
unit->n_items = items.size();
std::string func_name = module_name + "__global_statements";
std::string func_name = module_name + "global_stmts";
// Wrap all the global statements into a Function
LCompilers::PassOptions pass_options;
pass_options.run_fun = func_name;
Expand Down

0 comments on commit 7ff545d

Please sign in to comment.