Skip to content

Commit 412a023

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Revert to first base class lookup fix.
- Just checking that the scope is a class is probably the best way after all. Belonging to [master]: - OpenModelica/OMCompiler#2555
1 parent e3f55e4 commit 412a023

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Compiler/NFFrontEnd/NFLookup.mo

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function lookupSimpleName
359359
input InstNode scope;
360360
output InstNode node;
361361
protected
362-
InstNode cur_scope = InstNode.classScope(scope);
362+
InstNode cur_scope = scope;
363363
algorithm
364364
// Look for the name in each enclosing scope, until it's either found or we
365365
// run out of scopes.
@@ -370,13 +370,13 @@ algorithm
370370
else
371371
// TODO: Handle encapsulated scopes.
372372
// If the scope has the same name as we're looking for we can just return it.
373-
if name == InstNode.name(cur_scope) then
373+
if name == InstNode.name(cur_scope) and InstNode.isClass(cur_scope) then
374374
node := cur_scope;
375375
return;
376-
else
377-
// Otherwise, continue in the enclosing scope.
378-
cur_scope := InstNode.parentScope(cur_scope);
379376
end if;
377+
378+
// Otherwise, continue in the enclosing scope.
379+
cur_scope := InstNode.parentScope(cur_scope);
380380
end try;
381381
end for;
382382

0 commit comments

Comments
 (0)