Skip to content

Commit

Permalink
[NF] Fix redeclare final, for real this time.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Mar 19, 2018
1 parent 9d7f3fd commit df1cb27
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Compiler/NFFrontEnd/NFInst.mo
Expand Up @@ -729,7 +729,8 @@ algorithm
function instExtends(attributes = attributes, visibility = ExtendsVisibility.PUBLIC));

// Instantiate local components.
ClassTree.applyLocalComponents(cls_tree, function instComponent(attributes = attributes));
ClassTree.applyLocalComponents(cls_tree,
function instComponent(attributes = attributes, innerMod = Modifier.NOMOD()));

// Remove duplicate elements.
cls_tree := ClassTree.replaceDuplicates(cls_tree);
Expand Down Expand Up @@ -999,7 +1000,8 @@ algorithm
ClassTree.mapExtends(cls_tree,
function instExtends(attributes = attributes, visibility = vis));

ClassTree.applyLocalComponents(cls_tree, function instComponent(attributes = attributes));
ClassTree.applyLocalComponents(cls_tree,
function instComponent(attributes = attributes, innerMod = Modifier.NOMOD()));
then
();

Expand Down Expand Up @@ -1143,7 +1145,7 @@ protected
algorithm
rdcl_node := Mutable.access(redeclareComp);
repl_node := Mutable.access(replaceableComp);
instComponent(repl_node, NFComponent.DEFAULT_ATTR);
instComponent(repl_node, NFComponent.DEFAULT_ATTR, Modifier.NOMOD());
redeclareComponent(rdcl_node, repl_node, Modifier.NOMOD(), Modifier.NOMOD(), NFComponent.DEFAULT_ATTR, rdcl_node);
outComp := Mutable.create(rdcl_node);
end redeclareComponentElement;
Expand Down Expand Up @@ -1243,11 +1245,12 @@ end redeclareClass;
function instComponent
input InstNode node "The component node to instantiate";
input Component.Attributes attributes "Attributes to be propagated to the component.";
input Modifier innerMod;
protected
Component comp;
SCode.Element def;
InstNode comp_node, rdcl_node;
Modifier outer_mod, cc_mod = Modifier.NOMOD();
Modifier outer_mod, cc_mod = innerMod;
SCode.Mod cc_smod;
String name;
Integer level;
Expand Down Expand Up @@ -1279,9 +1282,9 @@ algorithm

Modifier.REDECLARE(element = rdcl_node, mod = outer_mod) := outer_mod;
outer_mod := Modifier.merge(InstNode.getModifier(rdcl_node), outer_mod);
outer_mod := Modifier.merge(outer_mod, cc_mod);
//outer_mod := Modifier.merge(outer_mod, cc_mod);
InstNode.setModifier(outer_mod, rdcl_node);
redeclareComponent(rdcl_node, node, Modifier.NOMOD(), Modifier.NOMOD(), attributes, node);
redeclareComponent(rdcl_node, node, Modifier.NOMOD(), cc_mod, attributes, node);
else
instComponentDef(def, outer_mod, cc_mod, attributes, comp_node, level, parent, scope);
end if;
Expand Down Expand Up @@ -1377,7 +1380,7 @@ algorithm
fail();
end if;

instComponent(redeclareNode, outerAttr);
instComponent(redeclareNode, outerAttr, constrainingMod);
orig_comp := InstNode.component(originalNode);
rdcl_comp := InstNode.component(redeclareNode);

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

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

0 comments on commit df1cb27

Please sign in to comment.