Skip to content

Commit

Permalink
When traversing if-statements, preserve the reference pointer if noth…
Browse files Browse the repository at this point in the history
…ing changed (bugfix for the else/elseif parts)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20738 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed May 21, 2014
1 parent 3cbe652 commit fac3718
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Compiler/FrontEnd/DAEUtil.mo
Expand Up @@ -4337,17 +4337,22 @@ algorithm
list<DAE.Statement> st,st_1;
DAE.Else el,el_1;
Type_a extraArg;
Boolean b;
case (DAE.NOELSE(),_,_,extraArg) then (DAE.NOELSE(),extraArg);
case (DAE.ELSEIF(e,st,el),_,_,extraArg)
equation
(el_1,extraArg) = traverseDAEEquationsStmtsElse(el,func,opt,extraArg);
(st_1,extraArg) = traverseDAEEquationsStmtsList(st,func,opt,extraArg);
((e_1,extraArg)) = func((e, extraArg));
then (Algorithm.optimizeElseIf(e_1,st_1,el_1),extraArg);
outElse = Algorithm.optimizeElseIf(e_1,st_1,el_1);
b = referenceEq(el,el_1) and referenceEq(st,st_1) and referenceEq(e,e_1);
outElse = Util.if_(b,inElse,outElse);
then (outElse,extraArg);
case(DAE.ELSE(st),_,_,extraArg)
equation
(st_1,extraArg) = traverseDAEEquationsStmtsList(st,func,opt,extraArg);
then (DAE.ELSE(st_1),extraArg);
outElse = Util.if_(referenceEq(st,st_1),inElse,DAE.ELSE(st_1));
then (outElse,extraArg);
end match;
end traverseDAEEquationsStmtsElse;

Expand Down

0 comments on commit fac3718

Please sign in to comment.