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

Commit df1cb27

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Fix redeclare final, for real this time.
Belonging to [master]: - #2290 - OpenModelica/OpenModelica-testsuite#882
1 parent 9d7f3fd commit df1cb27

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

Compiler/NFFrontEnd/NFInst.mo

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,8 @@ algorithm
729729
function instExtends(attributes = attributes, visibility = ExtendsVisibility.PUBLIC));
730730

731731
// Instantiate local components.
732-
ClassTree.applyLocalComponents(cls_tree, function instComponent(attributes = attributes));
732+
ClassTree.applyLocalComponents(cls_tree,
733+
function instComponent(attributes = attributes, innerMod = Modifier.NOMOD()));
733734

734735
// Remove duplicate elements.
735736
cls_tree := ClassTree.replaceDuplicates(cls_tree);
@@ -999,7 +1000,8 @@ algorithm
9991000
ClassTree.mapExtends(cls_tree,
10001001
function instExtends(attributes = attributes, visibility = vis));
10011002

1002-
ClassTree.applyLocalComponents(cls_tree, function instComponent(attributes = attributes));
1003+
ClassTree.applyLocalComponents(cls_tree,
1004+
function instComponent(attributes = attributes, innerMod = Modifier.NOMOD()));
10031005
then
10041006
();
10051007

@@ -1143,7 +1145,7 @@ protected
11431145
algorithm
11441146
rdcl_node := Mutable.access(redeclareComp);
11451147
repl_node := Mutable.access(replaceableComp);
1146-
instComponent(repl_node, NFComponent.DEFAULT_ATTR);
1148+
instComponent(repl_node, NFComponent.DEFAULT_ATTR, Modifier.NOMOD());
11471149
redeclareComponent(rdcl_node, repl_node, Modifier.NOMOD(), Modifier.NOMOD(), NFComponent.DEFAULT_ATTR, rdcl_node);
11481150
outComp := Mutable.create(rdcl_node);
11491151
end redeclareComponentElement;
@@ -1243,11 +1245,12 @@ end redeclareClass;
12431245
function instComponent
12441246
input InstNode node "The component node to instantiate";
12451247
input Component.Attributes attributes "Attributes to be propagated to the component.";
1248+
input Modifier innerMod;
12461249
protected
12471250
Component comp;
12481251
SCode.Element def;
12491252
InstNode comp_node, rdcl_node;
1250-
Modifier outer_mod, cc_mod = Modifier.NOMOD();
1253+
Modifier outer_mod, cc_mod = innerMod;
12511254
SCode.Mod cc_smod;
12521255
String name;
12531256
Integer level;
@@ -1279,9 +1282,9 @@ algorithm
12791282

12801283
Modifier.REDECLARE(element = rdcl_node, mod = outer_mod) := outer_mod;
12811284
outer_mod := Modifier.merge(InstNode.getModifier(rdcl_node), outer_mod);
1282-
outer_mod := Modifier.merge(outer_mod, cc_mod);
1285+
//outer_mod := Modifier.merge(outer_mod, cc_mod);
12831286
InstNode.setModifier(outer_mod, rdcl_node);
1284-
redeclareComponent(rdcl_node, node, Modifier.NOMOD(), Modifier.NOMOD(), attributes, node);
1287+
redeclareComponent(rdcl_node, node, Modifier.NOMOD(), cc_mod, attributes, node);
12851288
else
12861289
instComponentDef(def, outer_mod, cc_mod, attributes, comp_node, level, parent, scope);
12871290
end if;
@@ -1377,7 +1380,7 @@ algorithm
13771380
fail();
13781381
end if;
13791382

1380-
instComponent(redeclareNode, outerAttr);
1383+
instComponent(redeclareNode, outerAttr, constrainingMod);
13811384
orig_comp := InstNode.component(originalNode);
13821385
rdcl_comp := InstNode.component(redeclareNode);
13831386

@@ -2610,7 +2613,7 @@ algorithm
26102613
// not part of the flat class.
26112614
if InstNode.isComponent(n) then
26122615
// The components shouldn't have been instantiated yet, so do it here.
2613-
instComponent(n, NFComponent.DEFAULT_ATTR);
2616+
instComponent(n, NFComponent.DEFAULT_ATTR, Modifier.NOMOD());
26142617

26152618
// If the component's class has a missingInnerMessage annotation, use it
26162619
// to give a diagnostic message.

0 commit comments

Comments
 (0)