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

Commit be0943f

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Fix scoping of redeclared components.
- Add InstNodeType to component nodes too, and use it to keep track of the parent of the replaced component. This is then used by InstNode.scopeList, so that crefs pointing to redeclared components are generated correctly. Belonging to [master]: - #2904
1 parent 247f185 commit be0943f

5 files changed

Lines changed: 101 additions & 37 deletions

File tree

Compiler/NFFrontEnd/NFBuiltin.mo

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -160,25 +160,35 @@ constant ClassTree REAL_CLASS_TREE = ClassTree.FLAT_TREE(
160160
listArrayLiteral({}),
161161
listArrayLiteral({
162162
InstNode.COMPONENT_NODE("quantity", Visibility.PUBLIC,
163-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
163+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(),
164+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
164165
InstNode.COMPONENT_NODE("unit", Visibility.PUBLIC,
165-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
166+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(),
167+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
166168
InstNode.COMPONENT_NODE("displayUnit", Visibility.PUBLIC,
167-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
169+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(),
170+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
168171
InstNode.COMPONENT_NODE("min", Visibility.PUBLIC,
169-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.REAL(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
172+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.REAL(),
173+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
170174
InstNode.COMPONENT_NODE("max", Visibility.PUBLIC,
171-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.REAL(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
175+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.REAL(),
176+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
172177
InstNode.COMPONENT_NODE("start", Visibility.PUBLIC,
173-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.REAL(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
178+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.REAL(),
179+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
174180
InstNode.COMPONENT_NODE("fixed", Visibility.PUBLIC,
175-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
181+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(),
182+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
176183
InstNode.COMPONENT_NODE("nominal", Visibility.PUBLIC,
177-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.REAL(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
184+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.REAL(),
185+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
178186
InstNode.COMPONENT_NODE("unbounded", Visibility.PUBLIC,
179-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
187+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(),
188+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
180189
InstNode.COMPONENT_NODE("stateSelect", Visibility.PUBLIC,
181-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(STATESELECT_TYPE, Modifier.NOMOD())), InstNode.EMPTY_NODE())
190+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(STATESELECT_TYPE,
191+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP())
182192
}),
183193
listArray({}), // TODO: #4895: This should be listArrayLiteral too, but causes compilation issues.
184194
DuplicateTree.EMPTY());
@@ -208,15 +218,20 @@ constant ClassTree INTEGER_CLASS_TREE = ClassTree.FLAT_TREE(
208218
listArrayLiteral({}),
209219
listArrayLiteral({
210220
InstNode.COMPONENT_NODE("quantity", Visibility.PUBLIC,
211-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
221+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(),
222+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
212223
InstNode.COMPONENT_NODE("min", Visibility.PUBLIC,
213-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.INTEGER(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
224+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.INTEGER(),
225+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
214226
InstNode.COMPONENT_NODE("max", Visibility.PUBLIC,
215-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.INTEGER(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
227+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.INTEGER(),
228+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
216229
InstNode.COMPONENT_NODE("start", Visibility.PUBLIC,
217-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.INTEGER(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
230+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.INTEGER(),
231+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
218232
InstNode.COMPONENT_NODE("fixed", Visibility.PUBLIC,
219-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(), Modifier.NOMOD())), InstNode.EMPTY_NODE())
233+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(),
234+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP())
220235
}),
221236
listArray({}), // TODO: #4895: This should be listArrayLiteral too, but causes compilation issues.
222237
DuplicateTree.EMPTY());
@@ -240,11 +255,14 @@ constant ClassTree BOOLEAN_CLASS_TREE = ClassTree.FLAT_TREE(
240255
listArrayLiteral({}),
241256
listArrayLiteral({
242257
InstNode.COMPONENT_NODE("quantity", Visibility.PUBLIC,
243-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
258+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(),
259+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
244260
InstNode.COMPONENT_NODE("start", Visibility.PUBLIC,
245-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
261+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(),
262+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
246263
InstNode.COMPONENT_NODE("fixed", Visibility.PUBLIC,
247-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(), Modifier.NOMOD())), InstNode.EMPTY_NODE())
264+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(),
265+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP())
248266
}),
249267
listArray({}), // TODO: #4895: This should be listArrayLiteral too, but causes compilation issues.
250268
DuplicateTree.EMPTY());
@@ -271,11 +289,14 @@ constant ClassTree STRING_CLASS_TREE = ClassTree.FLAT_TREE(
271289
listArrayLiteral({}),
272290
listArrayLiteral({
273291
InstNode.COMPONENT_NODE("quantity", Visibility.PUBLIC,
274-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
292+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(),
293+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
275294
InstNode.COMPONENT_NODE("start", Visibility.PUBLIC,
276-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
295+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(),
296+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
277297
InstNode.COMPONENT_NODE("fixed", Visibility.PUBLIC,
278-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(), Modifier.NOMOD())), InstNode.EMPTY_NODE())
298+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.BOOLEAN(),
299+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP())
279300
}),
280301
listArray({}), // TODO: #4895: This should be listArrayLiteral too, but causes compilation issues.
281302
DuplicateTree.EMPTY());
@@ -333,11 +354,14 @@ constant ClassTree CLOCK_CLASS_TREE = ClassTree.FLAT_TREE(
333354
listArrayLiteral({}),
334355
listArrayLiteral({
335356
InstNode.COMPONENT_NODE("quantity", Visibility.PUBLIC,
336-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
357+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.STRING(),
358+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
337359
InstNode.COMPONENT_NODE("start", Visibility.PUBLIC,
338-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.CLOCK(), Modifier.NOMOD())), InstNode.EMPTY_NODE()),
360+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.CLOCK(),
361+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP()),
339362
InstNode.COMPONENT_NODE("fixed", Visibility.PUBLIC,
340-
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.CLOCK(), Modifier.NOMOD())), InstNode.EMPTY_NODE())
363+
Pointer.createImmutable(Component.TYPE_ATTRIBUTE(Type.CLOCK(),
364+
Modifier.NOMOD())), InstNode.EMPTY_NODE(), InstNodeType.NORMAL_COMP())
341365
}),
342366
listArray({}), // TODO: #4895: This should be listArrayLiteral too, but causes compilation issues.
343367
DuplicateTree.EMPTY());
@@ -362,7 +386,8 @@ constant InstNode TIME =
362386
NFComponent.INPUT_ATTR,
363387
NONE(),
364388
Absyn.dummyInfo)),
365-
InstNode.EMPTY_NODE());
389+
InstNode.EMPTY_NODE(),
390+
InstNodeType.NORMAL_COMP());
366391

367392
constant ComponentRef TIME_CREF = ComponentRef.CREF(TIME, {}, Type.REAL(), Origin.CREF, ComponentRef.EMPTY());
368393

Compiler/NFFrontEnd/NFBuiltinFuncs.mo

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,39 +81,44 @@ constant Component INT_COMPONENT = Component.TYPED_COMPONENT(NFInstNode.EMPTY_NO
8181

8282
constant InstNode INT_PARAM = InstNode.COMPONENT_NODE("i",
8383
Visibility.PUBLIC,
84-
Pointer.createImmutable(INT_COMPONENT), InstNode.EMPTY_NODE());
84+
Pointer.createImmutable(INT_COMPONENT), InstNode.EMPTY_NODE(),
85+
InstNodeType.NORMAL_COMP());
8586

8687
// Default Real parameter.
8788
constant Component REAL_COMPONENT = Component.TYPED_COMPONENT(NFInstNode.EMPTY_NODE(),
8889
Type.REAL(), NFBinding.EMPTY_BINDING, NFBinding.EMPTY_BINDING, NFComponent.DEFAULT_ATTR, NONE(), Absyn.dummyInfo);
8990

9091
constant InstNode REAL_PARAM = InstNode.COMPONENT_NODE("r",
9192
Visibility.PUBLIC,
92-
Pointer.createImmutable(REAL_COMPONENT), InstNode.EMPTY_NODE());
93+
Pointer.createImmutable(REAL_COMPONENT), InstNode.EMPTY_NODE(),
94+
InstNodeType.NORMAL_COMP());
9395

9496
// Default Boolean parameter.
9597
constant Component BOOL_COMPONENT = Component.TYPED_COMPONENT(NFInstNode.EMPTY_NODE(),
9698
Type.BOOLEAN(), NFBinding.EMPTY_BINDING, NFBinding.EMPTY_BINDING, NFComponent.DEFAULT_ATTR, NONE(), Absyn.dummyInfo);
9799

98100
constant InstNode BOOL_PARAM = InstNode.COMPONENT_NODE("b",
99101
Visibility.PUBLIC,
100-
Pointer.createImmutable(BOOL_COMPONENT), InstNode.EMPTY_NODE());
102+
Pointer.createImmutable(BOOL_COMPONENT), InstNode.EMPTY_NODE(),
103+
InstNodeType.NORMAL_COMP());
101104

102105
// Default String parameter.
103106
constant Component STRING_COMPONENT = Component.TYPED_COMPONENT(NFInstNode.EMPTY_NODE(),
104107
Type.STRING(), NFBinding.EMPTY_BINDING, NFBinding.EMPTY_BINDING, NFComponent.DEFAULT_ATTR, NONE(), Absyn.dummyInfo);
105108

106109
constant InstNode STRING_PARAM = InstNode.COMPONENT_NODE("s",
107110
Visibility.PUBLIC,
108-
Pointer.createImmutable(STRING_COMPONENT), InstNode.EMPTY_NODE());
111+
Pointer.createImmutable(STRING_COMPONENT), InstNode.EMPTY_NODE(),
112+
InstNodeType.NORMAL_COMP());
109113

110114
// Default enumeration(:) parameter.
111115
constant Component ENUM_COMPONENT = Component.TYPED_COMPONENT(NFInstNode.EMPTY_NODE(),
112116
Type.ENUMERATION_ANY(), NFBinding.EMPTY_BINDING, NFBinding.EMPTY_BINDING, NFComponent.DEFAULT_ATTR, NONE(), Absyn.dummyInfo);
113117

114118
constant InstNode ENUM_PARAM = InstNode.COMPONENT_NODE("e",
115119
Visibility.PUBLIC,
116-
Pointer.createImmutable(ENUM_COMPONENT), InstNode.EMPTY_NODE());
120+
Pointer.createImmutable(ENUM_COMPONENT), InstNode.EMPTY_NODE(),
121+
InstNodeType.NORMAL_COMP());
117122

118123
// Integer(e)
119124
constant array<NFInstNode.CachedData> EMPTY_NODE_CACHE = listArrayLiteral({
@@ -289,7 +294,8 @@ constant Component CLOCK_COMPONENT = Component.TYPED_COMPONENT(NFInstNode.EMPTY_
289294

290295
constant InstNode CLOCK_PARAM = InstNode.COMPONENT_NODE("s",
291296
Visibility.PUBLIC,
292-
Pointer.createImmutable(CLOCK_COMPONENT), InstNode.EMPTY_NODE());
297+
Pointer.createImmutable(CLOCK_COMPONENT), InstNode.EMPTY_NODE(),
298+
InstNodeType.NORMAL_COMP());
293299

294300
constant InstNode CLOCK_DUMMY_NODE = NFInstNode.CLASS_NODE("Clock",
295301
DUMMY_ELEMENT, Visibility.PUBLIC, Pointer.createImmutable(Class.NOT_INSTANTIATED()),

Compiler/NFFrontEnd/NFFlatten.mo

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ import SimplifyExp = NFSimplifyExp;
8888
import Restriction = NFRestriction;
8989
import EvalConstants = NFEvalConstants;
9090
import SimplifyModel = NFSimplifyModel;
91+
import InstNodeType = NFInstNode.InstNodeType;
9192

9293
public
9394
type FunctionTree = FunctionTreeImpl.Tree;
@@ -649,7 +650,11 @@ algorithm
649650
algorithm
650651
iter := match ComponentRef.node(prefix)
651652
case prefix_node as InstNode.COMPONENT_NODE()
652-
then InstNode.COMPONENT_NODE("$i", prefix_node.visibility, Pointer.create(Component.ITERATOR(Type.INTEGER(), Variability.IMPLICITLY_DISCRETE, Component.info(Pointer.access(prefix_node.component)))), prefix_node.parent);
653+
then InstNode.COMPONENT_NODE(
654+
"$i", prefix_node.visibility,
655+
Pointer.create(Component.ITERATOR(Type.INTEGER(), Variability.IMPLICITLY_DISCRETE,
656+
Component.info(Pointer.access(prefix_node.component)))),
657+
prefix_node.parent, InstNodeType.NORMAL_COMP());
653658
end match;
654659
{Dimension.INTEGER(size = stop)} := dimensions;
655660
range := Expression.RANGE(Type.INTEGER(), Expression.INTEGER(1), NONE(), Expression.INTEGER(stop));
@@ -679,7 +684,11 @@ algorithm
679684
algorithm
680685
iter := match ComponentRef.node(prefix)
681686
case prefix_node as InstNode.COMPONENT_NODE()
682-
then InstNode.COMPONENT_NODE("$i", prefix_node.visibility, Pointer.create(Component.ITERATOR(Type.INTEGER(), Variability.IMPLICITLY_DISCRETE, Component.info(Pointer.access(prefix_node.component)))), prefix_node.parent);
687+
then InstNode.COMPONENT_NODE(
688+
"$i", prefix_node.visibility,
689+
Pointer.create(Component.ITERATOR(Type.INTEGER(), Variability.IMPLICITLY_DISCRETE,
690+
Component.info(Pointer.access(prefix_node.component)))),
691+
prefix_node.parent, InstNodeType.NORMAL_COMP());
683692
end match;
684693
{Dimension.INTEGER(size = stop)} := dimensions;
685694
range := Expression.RANGE(Type.INTEGER(), Expression.INTEGER(1), NONE(), Expression.INTEGER(stop));

Compiler/NFFrontEnd/NFInst.mo

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,8 @@ protected
14001400
Component.Attributes attr;
14011401
array<Dimension> dims;
14021402
Option<SCode.Comment> cmt;
1403+
InstNode rdcl_node;
1404+
InstNodeType rdcl_type;
14031405
algorithm
14041406
// Check that the redeclare element actually is a component.
14051407
if not InstNode.isComponent(redeclareNode) then
@@ -1409,9 +1411,11 @@ algorithm
14091411
fail();
14101412
end if;
14111413

1412-
instComponent(redeclareNode, outerAttr, constrainingMod, true);
1414+
rdcl_type := InstNodeType.REDECLARED_COMP(InstNode.parent(originalNode));
1415+
rdcl_node := InstNode.setNodeType(rdcl_type, redeclareNode);
1416+
instComponent(rdcl_node, outerAttr, constrainingMod, true);
14131417
orig_comp := InstNode.component(originalNode);
1414-
rdcl_comp := InstNode.component(redeclareNode);
1418+
rdcl_comp := InstNode.component(rdcl_node);
14151419

14161420
new_comp := match (orig_comp, rdcl_comp)
14171421
case (Component.UNTYPED_COMPONENT(), Component.UNTYPED_COMPONENT())

Compiler/NFFrontEnd/NFInstNode.mo

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ uniontype InstNodeType
8080
record ROOT_CLASS
8181
"The root of the instance tree, i.e. the class that the instantiation starts from."
8282
end ROOT_CLASS;
83+
84+
record NORMAL_COMP
85+
end NORMAL_COMP;
86+
87+
record REDECLARED_COMP
88+
InstNode parent "The parent of the replaced component";
89+
end REDECLARED_COMP;
8390
end InstNodeType;
8491

8592
encapsulated package NodeTree
@@ -226,6 +233,7 @@ uniontype InstNode
226233
Visibility visibility;
227234
Pointer<Component> component;
228235
InstNode parent "The instance that this component is part of.";
236+
InstNodeType nodeType;
229237
end COMPONENT_NODE;
230238

231239
record INNER_OUTER_NODE
@@ -288,7 +296,7 @@ uniontype InstNode
288296
algorithm
289297
SCode.COMPONENT(name = name, prefixes = SCode.PREFIXES(visibility = vis)) := definition;
290298
node := COMPONENT_NODE(name, Prefixes.visibilityFromSCode(vis),
291-
Pointer.create(Component.new(definition)), parent);
299+
Pointer.create(Component.new(definition)), parent, InstNodeType.NORMAL_COMP());
292300
end newComponent;
293301

294302
function newExtends
@@ -313,7 +321,8 @@ uniontype InstNode
313321
input InstNode parent;
314322
output InstNode node;
315323
algorithm
316-
node := COMPONENT_NODE(name, Visibility.PUBLIC, Pointer.create(component), parent);
324+
node := COMPONENT_NODE(name, Visibility.PUBLIC, Pointer.create(component),
325+
parent, InstNodeType.NORMAL_COMP());
317326
end fromComponent;
318327

319328
function isClass
@@ -760,6 +769,12 @@ uniontype InstNode
760769
then
761770
();
762771

772+
case COMPONENT_NODE()
773+
algorithm
774+
node.nodeType := nodeType;
775+
then
776+
();
777+
763778
else ();
764779
end match;
765780
end setNodeType;
@@ -859,8 +874,13 @@ uniontype InstNode
859874
output list<InstNode> scopes;
860875
algorithm
861876
scopes := match node
877+
local
878+
InstNode parent;
879+
862880
case CLASS_NODE() then scopeListClass(node, node.nodeType, includeRoot, accumScopes);
863881
case COMPONENT_NODE(parent = EMPTY_NODE()) then accumScopes;
882+
case COMPONENT_NODE(nodeType = InstNodeType.REDECLARED_COMP(parent = parent))
883+
then scopeList(parent, includeRoot, node :: accumScopes);
864884
case COMPONENT_NODE() then scopeList(node.parent, includeRoot, node :: accumScopes);
865885
case IMPLICIT_SCOPE() then scopeList(node.parentScope, includeRoot, accumScopes);
866886
else accumScopes;

0 commit comments

Comments
 (0)