Skip to content

Commit

Permalink
Some more tail recursion
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15234 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Feb 18, 2013
1 parent f0863f7 commit cc2355d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Compiler/FrontEnd/Inst.mo
Original file line number Diff line number Diff line change
Expand Up @@ -15833,7 +15833,7 @@ This function splits the Element list into four lists
output list<SCode.Element> extElts;
output list<SCode.Element> compElts;
algorithm
(cdefImpElts,classextendsElts,extElts,compElts) := matchcontinue (elts)
(cdefImpElts,classextendsElts,extElts,compElts) := match (elts)
local
list<SCode.Element> comps,xs;
SCode.Element cdef,imp,ext,comp;
Expand Down Expand Up @@ -15882,7 +15882,7 @@ algorithm
(cdefImpElts,classextendsElts,extElts,comps) = splitElts(xs);
then
(cdefImpElts,classextendsElts,extElts,comp::comps);
end matchcontinue;
end match;
end splitElts;

public function splitEltsNoComponents "
Expand Down
13 changes: 7 additions & 6 deletions Compiler/FrontEnd/Patternm.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ protected
list<DAE.Exp> resExps;
list<DAE.Type> resTypes;
algorithm
(outCache,elabCases,resExps,resTypes,outSt) := elabMatchCases2(cache,env,cases,tys,impl,st,performVectorization,pre,{},{});
(outCache,elabCases,resExps,resTypes,outSt) := elabMatchCases2(cache,env,cases,tys,impl,st,performVectorization,pre,{},{},{});
(elabCases,resType) := fixCaseReturnTypes(elabCases,resExps,resTypes,info);
end elabMatchCases;

Expand All @@ -1582,6 +1582,7 @@ protected function elabMatchCases2
input Option<Interactive.SymbolTable> inSt;
input Boolean performVectorization;
input Prefix.Prefix pre;
input list<DAE.MatchCase> inAccCases "Order does matter";
input list<DAE.Exp> inAccExps "Order does matter";
input list<DAE.Type> inAccTypes "Order does not matter";
output Env.Cache outCache;
Expand All @@ -1591,7 +1592,7 @@ protected function elabMatchCases2
output Option<Interactive.SymbolTable> outSt;
algorithm
(outCache,elabCases,resExps,resTypes,outSt) :=
match (inCache,inEnv,cases,tys,impl,inSt,performVectorization,pre,inAccExps,inAccTypes)
match (inCache,inEnv,cases,tys,impl,inSt,performVectorization,pre,inAccCases,inAccExps,inAccTypes)
local
Absyn.Case case_;
list<Absyn.Case> rest;
Expand All @@ -1604,12 +1605,12 @@ algorithm
list<DAE.Exp> accExps;
list<DAE.Type> accTypes;

case (cache,env,{},_,_,st,_,_,accExps,accTypes) then (cache,{},listReverse(accExps),listReverse(accTypes),st);
case (cache,env,case_::rest,_,_,st,_,_,accExps,accTypes)
case (cache,env,{},_,_,st,_,_,_,accExps,accTypes) then (cache,listReverse(inAccCases),listReverse(accExps),listReverse(accTypes),st);
case (cache,env,case_::rest,_,_,st,_,_,_,accExps,accTypes)
equation
(cache,elabCase,optExp,optType,st) = elabMatchCase(cache,env,case_,tys,impl,st,performVectorization,pre);
(cache,elabCases,accExps,accTypes,st) = elabMatchCases2(cache,env,rest,tys,impl,st,performVectorization,pre,List.consOption(optExp,accExps),List.consOption(optType,accTypes));
then (cache,elabCase::elabCases,accExps,accTypes,st);
(cache,elabCases,accExps,accTypes,st) = elabMatchCases2(cache,env,rest,tys,impl,st,performVectorization,pre,elabCase::inAccCases,List.consOption(optExp,accExps),List.consOption(optType,accTypes));
then (cache,elabCases,accExps,accTypes,st);
end match;
end elabMatchCases2;

Expand Down

0 comments on commit cc2355d

Please sign in to comment.