Skip to content

Commit

Permalink
[NF] Evaluate parameter subscripts.
Browse files Browse the repository at this point in the history
- Mark parameter subscripts as structural so that they're evaluated.
  This should ideally not be necessary, but the backend relies on it
  since the old frontend does it.

Belonging to [master]:
  - OpenModelica/OMCompiler#2771
  • Loading branch information
perost authored and OpenModelica-Hudson committed Nov 7, 2018
1 parent 98896ae commit 223798a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Compiler/NFFrontEnd/NFInst.mo
Expand Up @@ -2914,7 +2914,7 @@ algorithm
case Class.INSTANCED_BUILTIN(elements = cls_tree as ClassTree.FLAT_TREE())
algorithm
for c in cls_tree.components loop
updateImplicitVariabilityComp(c, evalAllParams);
updateImplicitVariabilityComp(c, evalAllParams);
end for;
then
();
Expand Down Expand Up @@ -3236,7 +3236,7 @@ end markStructuralParamsSubs;

function markStructuralParamsSub
input Subscript sub;
input output Integer dummy;
input output Integer dummy = 0;
algorithm
() := match sub
case Subscript.UNTYPED() algorithm markStructuralParamsExp(sub.exp); then ();
Expand Down
7 changes: 7 additions & 0 deletions Compiler/NFFrontEnd/NFTyping.mo
Expand Up @@ -1447,6 +1447,13 @@ algorithm
typedSubs := sub :: typedSubs;
variability := Prefixes.variabilityMax(variability, var);
i := i + 1;

// Mark parameter subscripts as structural so that they're evaluated.
// TODO: Ideally this shouldn't be needed, but the old frontend does it and
// the backend relies on it.
if var == Variability.PARAMETER then
Inst.markStructuralParamsSub(sub);
end if;
end for;

typedSubs := listReverseInPlace(typedSubs);
Expand Down

0 comments on commit 223798a

Please sign in to comment.