Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorter names for global_initializer() and global_statements() #2246

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
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
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
2 changes: 1 addition & 1 deletion tests/reference/asr-array_01_decl-39cf894.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-array_01_decl-39cf894.stdout",
"stdout_hash": "150d5c201e389b6a146b7c7779048379519336a4f035fd7c4bc74a3f",
"stdout_hash": "b45d33de49ca7e90f8327f100d88a858c8449acf8d8fa2bc527b346f",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
16 changes: 8 additions & 8 deletions tests/reference/asr-array_01_decl-39cf894.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@
(Integer 4)
()
),
__main____global_statements:
__main__global_stmts:
(Function
(SymbolTable
207
{

})
__main____global_statements
__main__global_stmts
(FunctionType
[]
()
Expand Down Expand Up @@ -918,22 +918,22 @@
(SymbolTable
208
{
__main____global_statements:
__main__global_stmts:
(ExternalSymbol
208
__main____global_statements
2 __main____global_statements
__main__global_stmts
2 __main__global_stmts
__main__
[]
__main____global_statements
__main__global_stmts
Public
)
})
main_program
[__main__]
[(SubroutineCall
208 __main____global_statements
2 __main____global_statements
208 __main__global_stmts
2 __main__global_stmts
[]
()
)]
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-array_02_decl-e8f6874.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-array_02_decl-e8f6874.stdout",
"stdout_hash": "161c1c315c83399ca9f2f303efe354535ecf820e5529dcddc5b9a059",
"stdout_hash": "40e73d0d895210f7571f8a31ef8d426401f5cb57819271790fb4f7d6",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
16 changes: 8 additions & 8 deletions tests/reference/asr-array_02_decl-e8f6874.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
(SymbolTable
2
{
__main____global_statements:
__main__global_stmts:
(Function
(SymbolTable
205
{

})
__main____global_statements
__main__global_stmts
(FunctionType
[]
()
Expand Down Expand Up @@ -704,22 +704,22 @@
(SymbolTable
206
{
__main____global_statements:
__main__global_stmts:
(ExternalSymbol
206
__main____global_statements
2 __main____global_statements
__main__global_stmts
2 __main__global_stmts
__main__
[]
__main____global_statements
__main__global_stmts
Public
)
})
main_program
[__main__]
[(SubroutineCall
206 __main____global_statements
2 __main____global_statements
206 __main__global_stmts
2 __main__global_stmts
[]
()
)]
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-bindc_01-6d521a9.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-bindc_01-6d521a9.stdout",
"stdout_hash": "6d5d14fd8d94205b92c250418a6b8f8db22282bd6d5f9d10677ef660",
"stdout_hash": "ec7543eae1d1bbaeba72993e35e98165ba0248ab59dc6597f9c50e7b",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
16 changes: 8 additions & 8 deletions tests/reference/asr-bindc_01-6d521a9.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
(SymbolTable
2
{
__main____global_statements:
__main__global_stmts:
(Function
(SymbolTable
4
{

})
__main____global_statements
__main__global_stmts
(FunctionType
[]
()
Expand Down Expand Up @@ -185,22 +185,22 @@
(SymbolTable
5
{
__main____global_statements:
__main__global_stmts:
(ExternalSymbol
5
__main____global_statements
2 __main____global_statements
__main__global_stmts
2 __main__global_stmts
__main__
[]
__main____global_statements
__main__global_stmts
Public
)
})
main_program
[__main__]
[(SubroutineCall
5 __main____global_statements
2 __main____global_statements
5 __main__global_stmts
2 __main__global_stmts
[]
()
)]
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-bindc_02-bc1a7ea.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-bindc_02-bc1a7ea.stdout",
"stdout_hash": "85f0714bd83ac6e159ac5495baa2359741e49e63b8ac049093b27f42",
"stdout_hash": "e7c1aac9ae8d0cc269135f3d79b99fbda0574b09d8d7d20bced754ec",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
16 changes: 8 additions & 8 deletions tests/reference/asr-bindc_02-bc1a7ea.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
(SymbolTable
2
{
__main____global_statements:
__main__global_stmts:
(Function
(SymbolTable
201
{

})
__main____global_statements
__main__global_stmts
(FunctionType
[]
()
Expand Down Expand Up @@ -396,22 +396,22 @@
(SymbolTable
202
{
__main____global_statements:
__main__global_stmts:
(ExternalSymbol
202
__main____global_statements
2 __main____global_statements
__main__global_stmts
2 __main__global_stmts
__main__
[]
__main____global_statements
__main__global_stmts
Public
)
})
main_program
[__main__]
[(SubroutineCall
202 __main____global_statements
2 __main____global_statements
202 __main__global_stmts
2 __main__global_stmts
[]
()
)]
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-callback_01-df40fd5.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-callback_01-df40fd5.stdout",
"stdout_hash": "6d2cb98041fd7ca591cdd1d108b8e33cf28596ae877e7483040b53f3",
"stdout_hash": "5be73c5b09034604701853c55fffbdca38993aa3f92782e89a50c91e",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
16 changes: 8 additions & 8 deletions tests/reference/asr-callback_01-df40fd5.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
(SymbolTable
2
{
__main____global_statements:
__main__global_stmts:
(Function
(SymbolTable
9
{

})
__main____global_statements
__main__global_stmts
(FunctionType
[]
()
Expand Down Expand Up @@ -544,22 +544,22 @@
(SymbolTable
10
{
__main____global_statements:
__main__global_stmts:
(ExternalSymbol
10
__main____global_statements
2 __main____global_statements
__main__global_stmts
2 __main__global_stmts
__main__
[]
__main____global_statements
__main__global_stmts
Public
)
})
main_program
[__main__]
[(SubroutineCall
10 __main____global_statements
2 __main____global_statements
10 __main__global_stmts
2 __main__global_stmts
[]
()
)]
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-cast-435c233.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-cast-435c233.stdout",
"stdout_hash": "2eb7eb0ad87875a041581987ca9c61e0a10a7c9211300f7415798c18",
"stdout_hash": "fe198b3570faed74e1d6babc91b93c715f90a21cf5e19b40351e3299",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
16 changes: 8 additions & 8 deletions tests/reference/asr-cast-435c233.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
(SymbolTable
2
{
__main____global_statements:
__main__global_stmts:
(Function
(SymbolTable
126
{

})
__main____global_statements
__main__global_stmts
(FunctionType
[]
()
Expand Down Expand Up @@ -253,22 +253,22 @@
(SymbolTable
127
{
__main____global_statements:
__main__global_stmts:
(ExternalSymbol
127
__main____global_statements
2 __main____global_statements
__main__global_stmts
2 __main__global_stmts
__main__
[]
__main____global_statements
__main__global_stmts
Public
)
})
main_program
[__main__]
[(SubroutineCall
127 __main____global_statements
2 __main____global_statements
127 __main__global_stmts
2 __main__global_stmts
[]
()
)]
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-doconcurrentloop_01-3fdc189.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "asr-doconcurrentloop_01-3fdc189.stdout",
"stdout_hash": "7442f71652c630ae36046e585b31c0983ecf34c08a4b373524d28d21",
"stdout_hash": "0975f7d22eeb12c370338f1c6b5edb6292a8f4e076cb484ccab66b06",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
Loading