Skip to content

Commit

Permalink
- enable BackendEquation.traverseExpsOfEquationList to replace crefs …
Browse files Browse the repository at this point in the history
…with constants

- removed fail message

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24641 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Volker Waurich committed Feb 19, 2015
1 parent 7f784b9 commit cf0776b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Compiler/BackEnd/BackendEquation.mo
Expand Up @@ -679,15 +679,25 @@ algorithm
case BackendDAE.WHEN_EQUATION(size=size, whenEquation=BackendDAE.WHEN_EQ(condition=cond, left=cr, right=e2, elsewhenPart=NONE()), source=source, attr=attr) equation
tp = Expression.typeof(e2);
e1 = Expression.makeCrefExp(cr, tp);
(DAE.CREF(cr1, _), extArg) = inFunc(e1, inTypeA);
(e1, extArg) = inFunc(e1, inTypeA);
if Expression.isCref(e1) then
DAE.CREF(cr1, _) = e1;
else
cr1=cr;
end if;
(e_2, extArg) = inFunc(e2, extArg);
(cond, extArg) = inFunc(cond, extArg);
then (BackendDAE.WHEN_EQUATION(size, BackendDAE.WHEN_EQ(cond, cr1, e_2, NONE()), source, attr), extArg);

case BackendDAE.WHEN_EQUATION(size=size, whenEquation=BackendDAE.WHEN_EQ(condition=cond, left=cr, right=e2, elsewhenPart=SOME(elsePart)), source=source, attr=attr) equation
tp = Expression.typeof(e2);
e1 = Expression.makeCrefExp(cr, tp);
(DAE.CREF(cr1, _), extArg) = inFunc(e1, inTypeA);
(e1, extArg) = inFunc(e1, inTypeA);
if Expression.isCref(e1) then
DAE.CREF(cr1, _) = e1;
else
cr1=cr;
end if;
(e_2, extArg) = inFunc(e2, extArg);
(cond, extArg) = inFunc(cond, extArg);
(BackendDAE.WHEN_EQUATION(whenEquation=elsePart1), extArg) = traverseExpsOfEquation(BackendDAE.WHEN_EQUATION(size, elsePart, source, attr), inFunc, extArg);
Expand Down Expand Up @@ -2841,7 +2851,7 @@ algorithm
case(BackendDAE.WHEN_EQUATION(whenEquation=BackendDAE.WHEN_EQ(condition=DAE.BCONST(bool=true),right=exp1)))
then exp1;
else
equation print("BackendEquation.getEquationRHS failed!\n!");
//equation print("BackendEquation.getEquationRHS failed!\n!");
then fail();
end matchcontinue;
end getEquationRHS;
Expand All @@ -2866,7 +2876,7 @@ algorithm
case(BackendDAE.WHEN_EQUATION(whenEquation=BackendDAE.WHEN_EQ(condition=DAE.BCONST(bool=true),left=cref)))
then Expression.crefExp(cref);
else
equation print("BackendEquation.getEquationLHS failed!\n");
//equation print("BackendEquation.getEquationLHS failed!\n");
then fail();
end matchcontinue;
end getEquationLHS;
Expand Down

0 comments on commit cf0776b

Please sign in to comment.