Skip to content

Commit

Permalink
Some stack overflow fixes
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17069 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Sep 5, 2013
1 parent d1b206e commit aff2c24
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Compiler/FrontEnd/DAEUtil.mo
Expand Up @@ -5344,7 +5344,7 @@ algorithm
case (_, _)
equation
paths1 = getUniontypePathsFunctions(funcs);
paths2 = getUniontypePathsElements(els);
paths2 = getUniontypePathsElements(els,{});
// Use accumulators? Small gain as T_METAUNIONTYPE has lists of paths anyway?
outPaths = listAppend(paths1, paths2);
then outPaths;
Expand All @@ -5364,29 +5364,29 @@ algorithm
(_,(_,els1)) = traverseDAEFunctions(elements, Expression.traverseSubexpressionsHelper, (collectLocalDecls,{}), {});
els2 = getFunctionsElements(elements);
els = listAppend(els1, els2);
outPaths = getUniontypePathsElements(els);
outPaths = getUniontypePathsElements(els,{});
then outPaths;
end match;
end getUniontypePathsFunctions;

protected function getUniontypePathsElements
"May contain duplicates."
input list<DAE.Element> elements;
input list<DAE.Type> acc;
output list<Absyn.Path> outPaths;
algorithm
outPaths := match elements
outPaths := match (elements,acc)
local
list<Absyn.Path> paths1;
list<DAE.Element> rest;
list<DAE.Type> tys;
DAE.Type ft;
case {} then {};
case DAE.VAR(ty = ft)::rest
case ({},_) then List.applyAndFold(acc, listAppend, Types.getUniontypePaths, {});
case (DAE.VAR(ty = ft)::rest,_)
equation
paths1 = getUniontypePathsElements(rest);
tys = Types.getAllInnerTypesOfType(ft, Types.uniontypeFilter);
then List.applyAndFold(tys, listAppend, Types.getUniontypePaths, paths1);
case _::rest then getUniontypePathsElements(rest);
then getUniontypePathsElements(rest,listAppend(tys,acc));
case (_::rest,_) then getUniontypePathsElements(rest,acc);
end match;
end getUniontypePathsElements;

Expand Down

0 comments on commit aff2c24

Please sign in to comment.