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

Commit ea246de

Browse files
perostOpenModelica-Hudson
authored andcommitted
NFInst fixes.
- Use correct parent in NFInst.modifyExtends. - Use DAE.T_FUNCTION when converting a function to DAE. Belonging to [master]: - #2044
1 parent df577f2 commit ea246de

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Compiler/NFFrontEnd/NFFunction.mo

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,13 +771,14 @@ uniontype Function
771771
SCode.Visibility vis;
772772
Boolean par, impr;
773773
DAE.InlineType ity;
774+
DAE.Type ty;
774775
algorithm
775776
vis := SCode.PUBLIC(); // TODO: Use the actual visibility.
776777
par := false; // TODO: Use the actual partial prefix.
777778
impr := fn.attributes.isImpure;
778779
ity := fn.attributes.inline;
779-
daeFn := DAE.FUNCTION(fn.path, defs, Type.toDAE(fn.returnType), vis,
780-
par, impr, ity, DAE.emptyElementSource, NONE());
780+
ty := DAE.T_FUNCTION({}, Type.toDAE(fn.returnType), fn.attributes, fn.path);
781+
daeFn := DAE.FUNCTION(fn.path, defs, ty, vis, par, impr, ity, DAE.emptyElementSource, NONE());
781782
end toDAE;
782783

783784
protected

Compiler/NFFrontEnd/NFInst.mo

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ algorithm
606606
mod := Modifier.merge(cls_mod, mod);
607607

608608
// Apply the modifiers of extends nodes.
609-
ClassTree.mapExtends(cls_tree, function modifyExtends(scope = par));
609+
ClassTree.mapExtends(cls_tree, function modifyExtends(scope = par, parent = par));
610610

611611
// Apply modifier in this scope.
612612
applyModifier(mod, cls_tree, InstNode.name(node));
@@ -772,6 +772,7 @@ end instImport;
772772
function modifyExtends
773773
input output InstNode extendsNode;
774774
input InstNode scope;
775+
input InstNode parent;
775776
protected
776777
SCode.Element elem;
777778
Absyn.Path basepath;
@@ -782,12 +783,12 @@ protected
782783
ClassTree cls_tree;
783784
algorithm
784785
cls_tree := Class.classTree(InstNode.getClass(extendsNode));
785-
ClassTree.mapExtends(cls_tree, function modifyExtends(scope = extendsNode));
786+
ClassTree.mapExtends(cls_tree, function modifyExtends(scope = extendsNode, parent = parent));
786787

787788
// Replace the node in the node type with the given scope, so that crefs found
788789
// in this extends are prefixed correctly.
789790
InstNodeType.BASE_CLASS(definition = elem) := InstNode.nodeType(extendsNode);
790-
extendsNode := InstNode.setNodeType(InstNodeType.BASE_CLASS(scope, elem), extendsNode);
791+
extendsNode := InstNode.setNodeType(InstNodeType.BASE_CLASS(parent, elem), extendsNode);
791792

792793
// Create a modifier from the extends.
793794
ext_mod := Modifier.fromElement(elem, InstNode.level(scope) + 1, scope);

0 commit comments

Comments
 (0)