Skip to content

Commit

Permalink
make some traverseExpsOfExpList_WithStop tail recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
vruge committed Feb 16, 2016
1 parent 4492ef7 commit 3258410
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions Compiler/BackEnd/BackendEquation.mo
Expand Up @@ -1116,32 +1116,24 @@ protected function traverseExpsOfExpList_WithStop<T> "author Frenkel TUD
input list<DAE.Exp> inExpl;
input FuncExpType rel;
input T inExtArg;
output Boolean outBoolean;
output T outTypeA;
output Boolean outBoolean = true;
output T outTypeA = inExtArg;
partial function FuncExpType
input DAE.Exp inExp;
input T inTypeA;
output DAE.Exp outExp;
output Boolean cont;
output T outA;
end FuncExpType;algorithm
(outBoolean, outTypeA) := match(inExpl)
local
DAE.Exp e;
list<DAE.Exp> res;
T extArg;
Boolean b;

case {}
then (true, inExtArg);

case e::res equation
(_, b, extArg) = rel(e, inExtArg);
if b then
(b, extArg) = traverseExpsOfExpList_WithStop(res, rel, extArg);
end if;
then (b, extArg);
end match;
for e in inExpl loop
(_, outBoolean, outTypeA) := rel(e, outTypeA);
if not outBoolean then
break;
end if;
end for;

end traverseExpsOfExpList_WithStop;

public function traverseEquationArray<T> "author: Frenkel TUD
Expand Down

0 comments on commit 3258410

Please sign in to comment.