Changeset 5a6cea7 in OpenModelica
- Timestamp:
- 2021-11-24T17:22:50+01:00 (2 years ago)
- Parents:
- f6468ae
- git-author:
- Per Östlund <perost86@…> (11/24/21 17:11:27)
- git-committer:
- Per Östlund <perost86@…> (11/24/21 17:22:50)
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
OMCompiler/Compiler/NFFrontEnd/NFFunction.mo
r89b043ca r5a6cea7 2476 2476 output list<InstNode> dependencies; 2477 2477 protected 2478 UnorderedSet<InstNode> deps; 2479 algorithm 2480 // Use a set to store the dependencies to avoid duplicates. 2481 deps := UnorderedSet.new(InstNode.hash, InstNode.refEqual, 1); 2482 deps := getLocalDependencies2(node, locals, deps); 2483 2484 // If we have a record instance with fields that have bindings that refer to 2485 // other fields we'll get a dependency on the record instance itself here. 2486 // But that's actually fine, so remove it to avoid a false cycle being detected. 2487 UnorderedSet.remove(node, deps); 2488 2489 deps := Type.foldDims(InstNode.getType(node), 2490 function getLocalDependenciesDim(locals = locals), deps); 2491 2492 dependencies := UnorderedSet.toList(deps); 2493 end getLocalDependencies; 2494 2495 function getLocalDependencies2 2496 input InstNode node; 2497 input UnorderedSet<InstNode> locals; 2498 input output UnorderedSet<InstNode> dependencies; 2499 protected 2478 2500 Component comp; 2479 2501 Binding binding; 2480 UnorderedSet<InstNode> deps; 2481 algorithm 2482 // Use a set to store the dependencies to avoid duplicates. 2483 deps := UnorderedSet.new(InstNode.hash, InstNode.refEqual, 1); 2484 2502 algorithm 2485 2503 comp := InstNode.component(node); 2486 2504 binding := Component.getBinding(comp); 2487 2505 2488 2506 if Binding.hasExp(binding) then 2489 deps := getLocalDependenciesExp(Binding.getExp(binding), locals, deps); 2490 end if; 2491 2492 deps := Type.foldDims(Component.getType(comp), 2493 function getLocalDependenciesDim(locals = locals), deps); 2494 2495 dependencies := UnorderedSet.toList(deps); 2496 end getLocalDependencies; 2507 dependencies := getLocalDependenciesExp(Binding.getExp(binding), locals, dependencies); 2508 elseif Type.isRecord(Component.getType(comp)) then 2509 // If the component is a record instance without a binding, check the 2510 // bindings on the record fields instead. 2511 dependencies := ClassTree.foldComponents( 2512 Class.classTree(InstNode.getClass(node)), 2513 function getLocalDependencies2(locals = locals), dependencies); 2514 end if; 2515 end getLocalDependencies2; 2497 2516 2498 2517 function getLocalDependenciesExp -
testsuite/flattening/modelica/scodeinst/Makefile
r9f0cb452 r5a6cea7 585 585 FunctionCompOrder2.mo \ 586 586 FunctionCompOrder3.mo \ 587 FunctionCompOrder4.mo \ 587 588 FunctionDerivative1.mo \ 588 589 FunctionDerivativeInvalidInput1.mo \
Note: See TracChangeset
for help on using the changeset viewer.