Skip to content

Commit

Permalink
[NF] Use class scopes for function names.
Browse files Browse the repository at this point in the history
- 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]:
  - OpenModelica/OMCompiler#2431
  • Loading branch information
perost authored and OpenModelica-Hudson committed May 14, 2018
1 parent d47670a commit 52e894f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Compiler/NFFrontEnd/NFClass.mo
Expand Up @@ -487,8 +487,7 @@ uniontype Class
String lang;

case EXPANDED_DERIVED() then isExternalFunction(InstNode.getClass(cls.baseClass));
case INSTANCED_CLASS(sections = Sections.EXTERNAL(language = lang))
guard lang <> "builtin" then true;
case INSTANCED_CLASS(sections = Sections.EXTERNAL(language = lang)) then lang <> "builtin";
case TYPED_DERIVED() then isExternalFunction(InstNode.getClass(cls.baseClass));
else false;
end match;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/NFFrontEnd/NFFunction.mo
Expand Up @@ -266,7 +266,7 @@ uniontype Function
end try;

(functionRef, found_scope) := Lookup.lookupFunctionName(functionName, scope, info);
prefix := ComponentRef.fromNodeList(InstNode.scopeList(found_scope));
prefix := ComponentRef.fromNodeList(InstNode.scopeList(InstNode.classScope(found_scope)));
functionRef := ComponentRef.append(functionRef, prefix);
end lookupFunction;

Expand Down

0 comments on commit 52e894f

Please sign in to comment.