Skip to content

Commit

Permalink
Handle builtin functions in isConst
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - OpenModelica/OMCompiler#2340
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Apr 9, 2018
1 parent 0840339 commit cc58a7b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Compiler/FrontEnd/Expression.mo
Expand Up @@ -7886,6 +7886,7 @@ algorithm
Type t;
list<DAE.Exp> ae;
list<list<DAE.Exp>> matrix;
Absyn.Path path;

case (DAE.ICONST()) then true;
case (DAE.RCONST()) then true;
Expand Down Expand Up @@ -7966,6 +7967,10 @@ algorithm
if res then isConstWork(e1) else false;

case (DAE.CALL(expLst=ae, attr=DAE.CALL_ATTR(builtin=false, isImpure=false))) then isConstWorkList(ae);
case (DAE.CALL(path=path, expLst=ae, attr=DAE.CALL_ATTR(builtin=true))) then
if listMember(Absyn.pathFirstIdent(path),
{"initial","terminal","sample" /* der/edge/change/pre belongs to this list usually, but if we optimize the expression, we might end up with pre of a constant expression... */}
) then false else isConstWorkList(ae);

case (DAE.RECORD(exps=ae)) then isConstWorkList(ae);

Expand Down

0 comments on commit cc58a7b

Please sign in to comment.