Skip to content

Commit

Permalink
Do not generate function code for constants
Browse files Browse the repository at this point in the history
Constants are replaced by values and do not need to be duplicated in
functions. Currently, if evaluation of the constant fails, we get the
same constant that cannot be evaluated in the function prologue.
  • Loading branch information
sjoelund committed Apr 2, 2016
1 parent 141c87f commit 18bb4e8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Compiler/SimCode/SimCodeFunctionUtil.mo
Expand Up @@ -1478,7 +1478,7 @@ algorithm
DAE.VarDirection vd;
case DAE.VAR(kind=vk, direction=vd)
guard
isVarVarOrConstant(vk) and
isVarKindVarOrParameter(vk) and
isDirectionNotInput(vd)
then true;
else false;
Expand All @@ -1497,14 +1497,14 @@ algorithm
DAE.VarDirection vd;
case DAE.VAR(kind=vk, direction=vd)
guard
isVarVarOrConstant(vk) and
isVarKindVarOrParameter(vk) and
isDirectionNotInputNotOutput(vd)
then true;
else false;
end match;
end isVarNotInputNotOutput;

protected function isVarVarOrConstant
protected function isVarKindVarOrParameter
input DAE.VarKind inVarKind;
output Boolean outB;
algorithm
Expand All @@ -1514,7 +1514,7 @@ algorithm
case DAE.CONST() then true;
else false;
end match;
end isVarVarOrConstant;
end isVarKindVarOrParameter;

protected function isDirectionNotInput
input DAE.VarDirection inVarDirection;
Expand Down

0 comments on commit 18bb4e8

Please sign in to comment.