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

Commit 52e894f

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Use class scopes for function names.
- Use the enclosing scope of a function when generating it's name, instead of the found scope (which might be a component). This fixes some issues with external functions where the backend assumes the name is prefixed with the enclosing scope, and we don't yet generate unique instances for functions in components anyway. - Use better coding style in Class.isExternalFunction. Belonging to [master]: - #2431
1 parent d47670a commit 52e894f

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Compiler/NFFrontEnd/NFClass.mo

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,7 @@ uniontype Class
487487
String lang;
488488

489489
case EXPANDED_DERIVED() then isExternalFunction(InstNode.getClass(cls.baseClass));
490-
case INSTANCED_CLASS(sections = Sections.EXTERNAL(language = lang))
491-
guard lang <> "builtin" then true;
490+
case INSTANCED_CLASS(sections = Sections.EXTERNAL(language = lang)) then lang <> "builtin";
492491
case TYPED_DERIVED() then isExternalFunction(InstNode.getClass(cls.baseClass));
493492
else false;
494493
end match;

Compiler/NFFrontEnd/NFFunction.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ uniontype Function
266266
end try;
267267

268268
(functionRef, found_scope) := Lookup.lookupFunctionName(functionName, scope, info);
269-
prefix := ComponentRef.fromNodeList(InstNode.scopeList(found_scope));
269+
prefix := ComponentRef.fromNodeList(InstNode.scopeList(InstNode.classScope(found_scope)));
270270
functionRef := ComponentRef.append(functionRef, prefix);
271271
end lookupFunction;
272272

0 commit comments

Comments
 (0)