Skip to content

Commit

Permalink
Don't wrap functions within if expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
lochel authored and OpenModelica-Hudson committed Feb 23, 2016
1 parent 265024d commit 86267ae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Compiler/BackEnd/CommonSubExpression.mo
Expand Up @@ -243,7 +243,12 @@ protected function wrapFunctionCalls3
output DAE.Exp outExp;
output tuple<tuple<HashTableExpToExp.HashTable, Integer, list<BackendDAE.Equation>, list<BackendDAE.Var>, DAE.FunctionTree>, DAE.ElementSource> outTuple;
algorithm
(outExp, outTuple) := Expression.traverseExpBottomUp(inExp, wrapFunctionCalls_main, inTuple);
if Expression.isExpIfExp(inExp) then
outExp := inExp;
outTuple := inTuple;
else
(outExp, outTuple) := Expression.traverseExpBottomUp(inExp, wrapFunctionCalls_main, inTuple);
end if;
end wrapFunctionCalls3;

protected function wrapFunctionCalls_main
Expand Down
11 changes: 11 additions & 0 deletions Compiler/FrontEnd/Expression.mo
Expand Up @@ -9636,6 +9636,17 @@ algorithm
end match;
end isExpCrefOrIfExp;

public function isExpIfExp
"Returns true if expression is an if expression"
input DAE.Exp e;
output Boolean res;
algorithm
res := match(e)
case(DAE.IFEXP()) then true;
else false;
end match;
end isExpIfExp;

public function operatorEqual
"Helper function to expEqual."
input DAE.Operator inOperator1;
Expand Down

0 comments on commit 86267ae

Please sign in to comment.