@@ -577,7 +577,7 @@ class ASRToCVisitor : public BaseCCPPVisitor<ASRToCVisitor>
577577
578578 void visit_TranslationUnit (const ASR::TranslationUnit_t &x) {
579579 is_string_concat_present = false ;
580- global_scope = x.m_global_scope ;
580+ global_scope = x.m_symtab ;
581581 // All loose statements must be converted to a function, so the items
582582 // must be empty:
583583 LCOMPILERS_ASSERT (x.n_items == 0 );
605605 std::string tab (indentation_spaces, ' ' );
606606
607607 std::string unit_src_tmp;
608- for (auto &item : x.m_global_scope ->get_scope ()) {
608+ for (auto &item : x.m_symtab ->get_scope ()) {
609609 if (ASR::is_a<ASR::Variable_t>(*item.second )) {
610610 ASR::Variable_t *v = ASR::down_cast<ASR::Variable_t>(item.second );
611611 unit_src_tmp = convert_variable_decl (*v);
618618
619619
620620 std::map<std::string, std::vector<std::string>> struct_dep_graph;
621- for (auto &item : x.m_global_scope ->get_scope ()) {
621+ for (auto &item : x.m_symtab ->get_scope ()) {
622622 if (ASR::is_a<ASR::StructType_t>(*item.second ) ||
623623 ASR::is_a<ASR::EnumType_t>(*item.second ) ||
624624 ASR::is_a<ASR::UnionType_t>(*item.second )) {
@@ -634,14 +634,14 @@ R"(
634634 std::vector<std::string> struct_deps = ASRUtils::order_deps (struct_dep_graph);
635635
636636 for (auto &item : struct_deps) {
637- ASR::symbol_t * struct_sym = x.m_global_scope ->get_symbol (item);
637+ ASR::symbol_t * struct_sym = x.m_symtab ->get_symbol (item);
638638 visit_symbol (*struct_sym);
639639 array_types_decls += src;
640640 }
641641
642642 // Topologically sort all global functions
643643 // and then define them in the right order
644- std::vector<std::string> global_func_order = ASRUtils::determine_function_definition_order (x.m_global_scope );
644+ std::vector<std::string> global_func_order = ASRUtils::determine_function_definition_order (x.m_symtab );
645645
646646 unit_src += " \n " ;
647647 unit_src += " // Implementations\n " ;
@@ -651,10 +651,10 @@ R"(
651651 std::vector<std::string> build_order
652652 = ASRUtils::determine_module_dependencies (x);
653653 for (auto &item : build_order) {
654- LCOMPILERS_ASSERT (x.m_global_scope ->get_scope ().find (item)
655- != x.m_global_scope ->get_scope ().end ());
654+ LCOMPILERS_ASSERT (x.m_symtab ->get_scope ().find (item)
655+ != x.m_symtab ->get_scope ().end ());
656656 if (startswith (item, " lfortran_intrinsic" )) {
657- ASR::symbol_t *mod = x.m_global_scope ->get_symbol (item);
657+ ASR::symbol_t *mod = x.m_symtab ->get_symbol (item);
658658 if ( ASRUtils::get_body_size (mod) != 0 ) {
659659 visit_symbol (*mod);
660660 unit_src += src;
666666 // Process global functions
667667 size_t i;
668668 for (i = 0 ; i < global_func_order.size (); i++) {
669- ASR::symbol_t * sym = x.m_global_scope ->get_symbol (global_func_order[i]);
669+ ASR::symbol_t * sym = x.m_symtab ->get_symbol (global_func_order[i]);
670670 // Ignore external symbols because they are already defined by the loop above.
671671 if ( !sym || ASR::is_a<ASR::ExternalSymbol_t>(*sym) ) {
672672 continue ;
@@ -679,17 +679,17 @@ R"(
679679 std::vector<std::string> build_order
680680 = ASRUtils::determine_module_dependencies (x);
681681 for (auto &item : build_order) {
682- LCOMPILERS_ASSERT (x.m_global_scope ->get_scope ().find (item)
683- != x.m_global_scope ->get_scope ().end ());
682+ LCOMPILERS_ASSERT (x.m_symtab ->get_scope ().find (item)
683+ != x.m_symtab ->get_scope ().end ());
684684 if (!startswith (item, " lfortran_intrinsic" )) {
685- ASR::symbol_t *mod = x.m_global_scope ->get_symbol (item);
685+ ASR::symbol_t *mod = x.m_symtab ->get_symbol (item);
686686 visit_symbol (*mod);
687687 unit_src += src;
688688 }
689689 }
690690
691691 // Then the main program:
692- for (auto &item : x.m_global_scope ->get_scope ()) {
692+ for (auto &item : x.m_symtab ->get_scope ()) {
693693 if (ASR::is_a<ASR::Program_t>(*item.second )) {
694694 visit_symbol (*item.second );
695695 unit_src += src;
0 commit comments