Skip to content

Commit

Permalink
Robustify elabBuiltinDynamicSelect, ticket:3675
Browse files Browse the repository at this point in the history
The determination of dynamic values currently fails for
crefs with indices. Always return at least the static value.
  • Loading branch information
rfranke authored and OpenModelica-Hudson committed Oct 28, 2016
1 parent 76cba8f commit c655395
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Compiler/FrontEnd/Static.mo
Expand Up @@ -3862,7 +3862,8 @@ algorithm
{astatic, adynamic} := inPosArgs;
(outCache, dstatic, outProperties as DAE.PROP(ty, _), _) :=
elabExpInExpression(inCache, inEnv, astatic, inImplicit, NONE(), true, inPrefix, inInfo);
outExp := match (astatic, adynamic)
try
outExp := match (astatic, adynamic)
local
Absyn.ComponentRef acref;
Integer digits;
Expand All @@ -3887,10 +3888,11 @@ algorithm
// keep DynamicSelect for Boolean with cref arg (visible, primitivesVisible)
case (Absyn.BOOL(value = bconst), Absyn.CREF(componentRef = acref))
then Expression.makeArray({dstatic, Expression.crefToExp(absynCrefToComponentReference(acref))}, ty, true);
// return first argument of DynamicSelect for model editing per default
else algorithm
then dstatic;
end match;
end match;
// return first argument of DynamicSelect for model editing per default
else
outExp := dstatic;
end try;
end elabBuiltinDynamicSelect;

protected function elabBuiltinTranspose
Expand Down

0 comments on commit c655395

Please sign in to comment.