Skip to content

Commit

Permalink
move option creation out of outer loop
Browse files Browse the repository at this point in the history
  • Loading branch information
hkiel authored and OpenModelica-Hudson committed Jul 21, 2017
1 parent d30d68c commit 97fddd8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Compiler/Util/Graph.mo
Expand Up @@ -980,11 +980,12 @@ protected function addForbiddenColorsInt
input array<tuple<Integer, list<Integer>>> inGraph;
protected
list<Integer> indexes;
Option<list<Integer>> nodeopt = SOME({inNode});
algorithm
try
for node in nodes loop
((_,indexes)) := arrayGet(inGraph,node);
updateForbiddenColorArrayInt(indexes, inColored, forbiddenColor, inNode);
updateForbiddenColorArrayInt(indexes, inColored, forbiddenColor, nodeopt);
end for;
else
Error.addSourceMessage(Error.INTERNAL_ERROR, {"Graph.addForbiddenColors failed."}, sourceInfo());
Expand All @@ -996,15 +997,14 @@ protected function updateForbiddenColorArrayInt
input list<Integer> inIndexes;
input array<Integer> inColored;
input array<Option<list<Integer>>> inForbiddenColor;
input Integer inNode;
input Option<list<Integer>> inNode;
protected
Integer colorIndex;
Option<list<Integer>> opt = SOME({inNode});
algorithm
for index in inIndexes loop
colorIndex := arrayGet(inColored, index);
if colorIndex > 0 then
arrayUpdate(inForbiddenColor, colorIndex, opt);
arrayUpdate(inForbiddenColor, colorIndex, inNode);
end if;
end for;
end updateForbiddenColorArrayInt;
Expand Down

0 comments on commit 97fddd8

Please sign in to comment.