@@ -1409,7 +1409,8 @@ end addNomod;
14091409
14101410public function sortElementList
14111411 "Sorts constants and parameters by dependencies, so that they are instantiated
1412- before they are used."
1412+ before they are used.
1413+ For MetaModelica we just check for cycles. We do not do reordering"
14131414 input output list< Element > inElements;
14141415 input FCore . Graph inEnv;
14151416 input Boolean isFunctionScope;
@@ -1419,16 +1420,14 @@ protected
14191420 list< tuple< Element , list< Element >>> cycles;
14201421 list< tuple< Element , list< Element >>> g;
14211422algorithm
1422- // no sorting for meta-modelica!
1423+ // sort the elements according to the dependencies
1424+ g := Graph . buildGraph(inElements, getElementDependencies, (inElements,isFunctionScope));
1425+ (outE, cycles) := Graph . topologicalSort(g, isElementEqual);
14231426 if not Config . acceptMetaModelicaGrammar() then
1424- // sort the elements according to the dependencies
1425- g := Graph . buildGraph(inElements, getElementDependencies, (inElements,isFunctionScope));
1426- (outE, cycles) := Graph . topologicalSort(g, isElementEqual);
1427- // printGraph(inEnv, g, outE, cycles);
14281427 // append the elements in the cycles as they might not actually be cycles, but they depend on elements not in the list (i.e. package constants, etc)!
14291428 inElements := listAppend(outE, List . map(cycles, Util . tuple21));
1430- checkCyclicalComponents(cycles, inEnv);
14311429 end if ;
1430+ checkCyclicalComponents(cycles, inEnv);
14321431end sortElementList;
14331432
14341433protected function printGraph
0 commit comments