Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit ad7bdaf

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Improve handling of Evaluate=true.
- Also mark dependencies as structural for parameters that are structural due to Evaluate=true. Belonging to [master]: - #2750 - OpenModelica/OpenModelica-testsuite#1066
1 parent ff431bd commit ad7bdaf

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

Compiler/NFFrontEnd/NFInst.mo

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2937,7 +2937,7 @@ algorithm
29372937
// @adrpo: if Evaluate=true make the parameter a structural parameter
29382938
// only make it a structural parameter if is not constant, duh!, 1071 regressions :)
29392939
if c.attributes.variability == Variability.PARAMETER and Component.getEvaluateAnnotation(c) then
2940-
InstNode.updateComponent(Component.setVariability(Variability.STRUCTURAL_PARAMETER, c), node);
2940+
markStructuralParamsComp(c, node);
29412941
end if;
29422942

29432943
for dim in c.dimensions loop
@@ -3013,13 +3013,7 @@ algorithm
30133013
comp := InstNode.component(node);
30143014

30153015
if Component.variability(comp) == Variability.PARAMETER then
3016-
comp := Component.setVariability(Variability.STRUCTURAL_PARAMETER, comp);
3017-
InstNode.updateComponent(comp, node);
3018-
3019-
binding := Binding.untypedExp(Component.getBinding(comp));
3020-
if isSome(binding) then
3021-
markStructuralParamsExp(Util.getOption(binding));
3022-
end if;
3016+
markStructuralParamsComp(comp, node);
30233017
end if;
30243018
end if;
30253019
then
@@ -3029,6 +3023,22 @@ algorithm
30293023
end match;
30303024
end markStructuralParamsExp_traverser;
30313025

3026+
function markStructuralParamsComp
3027+
input Component component;
3028+
input InstNode node;
3029+
protected
3030+
Component comp;
3031+
Option<Expression> binding;
3032+
algorithm
3033+
comp := Component.setVariability(Variability.STRUCTURAL_PARAMETER, component);
3034+
InstNode.updateComponent(comp, node);
3035+
3036+
binding := Binding.untypedExp(Component.getBinding(comp));
3037+
if isSome(binding) then
3038+
markStructuralParamsExp(Util.getOption(binding));
3039+
end if;
3040+
end markStructuralParamsComp;
3041+
30323042
function markStructuralParamsExpSize
30333043
input Expression exp;
30343044
algorithm

0 commit comments

Comments
 (0)