From 412a02353dc0448242891d4b4c7d6cc9c2fc5321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=96stlund?= Date: Tue, 3 Jul 2018 14:57:04 +0200 Subject: [PATCH] [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 --- Compiler/NFFrontEnd/NFLookup.mo | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Compiler/NFFrontEnd/NFLookup.mo b/Compiler/NFFrontEnd/NFLookup.mo index a9ebbd77b8..259e3f3d53 100644 --- a/Compiler/NFFrontEnd/NFLookup.mo +++ b/Compiler/NFFrontEnd/NFLookup.mo @@ -359,7 +359,7 @@ function lookupSimpleName input InstNode scope; output InstNode node; protected - InstNode cur_scope = InstNode.classScope(scope); + InstNode cur_scope = scope; algorithm // Look for the name in each enclosing scope, until it's either found or we // run out of scopes. @@ -370,13 +370,13 @@ algorithm else // TODO: Handle encapsulated scopes. // If the scope has the same name as we're looking for we can just return it. - if name == InstNode.name(cur_scope) then + if name == InstNode.name(cur_scope) and InstNode.isClass(cur_scope) then node := cur_scope; return; - else - // Otherwise, continue in the enclosing scope. - cur_scope := InstNode.parentScope(cur_scope); end if; + + // Otherwise, continue in the enclosing scope. + cur_scope := InstNode.parentScope(cur_scope); end try; end for;