Skip to content

Commit 50e2b08

Browse files
XX formatting
1 parent 9252577 commit 50e2b08

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

src/libasr/codegen/asr_to_c.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -728,19 +728,17 @@ R"(
728728

729729
void visit_Module(const ASR::Module_t &x) {
730730
std::string unit_src = "";
731-
{
732-
std::string unit_src_tmp;
733-
for (auto &item : x.m_symtab->get_scope()) {
734-
if (ASR::is_a<ASR::Variable_t>(*item.second)) {
735-
ASR::Variable_t *v = ASR::down_cast<ASR::Variable_t>(
736-
item.second);
737-
unit_src_tmp = convert_variable_decl(*v);
738-
unit_src += unit_src_tmp;
739-
if(unit_src_tmp.size() > 0 &&
740-
(!ASR::is_a<ASR::Const_t>(*v->m_type) ||
741-
v->m_intent == ASRUtils::intent_return_var )) {
742-
unit_src += ";\n";
743-
}
731+
for (auto &item : x.m_symtab->get_scope()) {
732+
if (ASR::is_a<ASR::Variable_t>(*item.second)) {
733+
std::string unit_src_tmp;
734+
ASR::Variable_t *v = ASR::down_cast<ASR::Variable_t>(
735+
item.second);
736+
unit_src_tmp = convert_variable_decl(*v);
737+
unit_src += unit_src_tmp;
738+
if(unit_src_tmp.size() > 0 &&
739+
(!ASR::is_a<ASR::Const_t>(*v->m_type) ||
740+
v->m_intent == ASRUtils::intent_return_var )) {
741+
unit_src += ";\n";
744742
}
745743
}
746744
}

src/libasr/pass/global_stmts_program.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ void pass_wrap_global_stmts_into_program(Allocator &al,
2525
std::string prog_name = "main_program";
2626
Vec<ASR::stmt_t*> prog_body;
2727
prog_body.reserve(al, 1);
28+
Vec<char *> prog_dep;
29+
prog_dep.reserve(al, 1);
2830
if (unit.n_items > 0) {
2931
pass_wrap_global_stmts_into_function(al, unit, pass_options);
3032
pass_wrap_global_syms_into_module(al, unit, pass_options);
@@ -46,13 +48,11 @@ void pass_wrap_global_stmts_into_program(Allocator &al,
4648
nullptr, 0,
4749
nullptr);
4850
prog_body.push_back(al, ASR::down_cast<ASR::stmt_t>(stmt));
51+
prog_dep.push_back(al, s2c(al, "_global_symbols"));
4952
} else {
5053
throw LCompilersException("Return type not supported yet");
5154
}
5255
}
53-
Vec<char *> prog_dep;
54-
prog_dep.reserve(al, 1);
55-
prog_dep.push_back(al, s2c(al, "_global_symbols"));
5656
ASR::asr_t *prog = ASR::make_Program_t(
5757
al, unit.base.base.loc,
5858
/* a_symtab */ current_scope,

0 commit comments

Comments
 (0)