File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 645
645
array_types_decls += src;
646
646
}
647
647
648
+ if (x.m_global_scope ->get_symbol (" _global_symbols" ) != nullptr ) {
649
+ struct_dep_graph.clear ();
650
+ SymbolTable *global_symbols = ASR::down_cast<ASR::Module_t>(
651
+ x.m_global_scope ->get_symbol (" _global_symbols" ))->m_symtab ;
652
+ for (auto &item : global_symbols->get_scope ()) {
653
+ if (ASR::is_a<ASR::StructType_t>(*item.second ) ||
654
+ ASR::is_a<ASR::EnumType_t>(*item.second ) ||
655
+ ASR::is_a<ASR::UnionType_t>(*item.second )) {
656
+ std::vector<std::string> struct_deps_vec;
657
+ std::pair<char **, size_t > struct_deps_ptr = ASRUtils::symbol_dependencies (item.second );
658
+ for ( size_t i = 0 ; i < struct_deps_ptr.second ; i++ ) {
659
+ struct_deps_vec.push_back (std::string (struct_deps_ptr.first [i]));
660
+ }
661
+ struct_dep_graph[item.first ] = struct_deps_vec;
662
+ }
663
+ }
664
+
665
+ std::vector<std::string> struct_deps = ASRUtils::order_deps (struct_dep_graph);
666
+
667
+ for (auto &item : struct_deps) {
668
+ ASR::symbol_t * struct_sym = global_symbols->get_symbol (item);
669
+ visit_symbol (*struct_sym);
670
+ array_types_decls += src;
671
+ }
672
+ }
673
+
648
674
// Topologically sort all global functions
649
675
// and then define them in the right order
650
676
std::vector<std::string> global_func_order = ASRUtils::determine_function_definition_order (x.m_global_scope );
You can’t perform that action at this time.
0 commit comments