Skip to content

Commit

Permalink
fixed module encapsulateWhenConditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Aug 13, 2015
1 parent d97b9f4 commit d09df9f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Compiler/BackEnd/FindZeroCrossings.mo
Expand Up @@ -267,6 +267,8 @@ algorithm

HashTableExpToIndex.HashTable ht;

list<BackendDAE.WhenOperator> whenStmtLst;

// when
case BackendDAE.WHEN_EQ(condition=condition, left=left, right=right, elsewhenPart=NONE()) equation
(condition, vars, eqns, index, ht) = encapsulateWhenConditions_Equations1(condition, inSource, inIndex, inHT);
Expand All @@ -282,6 +284,21 @@ algorithm
eqns = listAppend(eqns, eqns1);
then (whenEquation, vars, eqns, index, ht);

// when - stmts
case BackendDAE.WHEN_STMTS(condition=condition, whenStmtLst=whenStmtLst, elsewhenPart=NONE()) equation
(condition, vars, eqns, index, ht) = encapsulateWhenConditions_Equations1(condition, inSource, inIndex, inHT);
whenEquation = BackendDAE.WHEN_STMTS(condition, whenStmtLst, NONE());
then (whenEquation, vars, eqns, index, ht);

// when - stmts - elsewhen
case BackendDAE.WHEN_STMTS(condition=condition, whenStmtLst=whenStmtLst, elsewhenPart=SOME(elsewhenPart)) equation
(elsewhenPart, vars1, eqns1, index, ht) = encapsulateWhenConditions_Equations(elsewhenPart, inSource, inIndex, inHT);
(condition, vars, eqns, index, ht) = encapsulateWhenConditions_Equations1(condition, inSource, index, ht);
whenEquation = BackendDAE.WHEN_STMTS(condition, whenStmtLst, SOME(elsewhenPart));
vars = listAppend(vars, vars1);
eqns = listAppend(eqns, eqns1);
then (whenEquation, vars, eqns, index, ht);

else equation
Error.addMessage(Error.INTERNAL_ERROR, {"./Compiler/BackEnd/FindZeroCrossings.mo: function encapsulateWhenConditions_Equations failed"});
then fail();
Expand Down

0 comments on commit d09df9f

Please sign in to comment.