Skip to content

Commit

Permalink
- If the adding component class is partial then declare the added com…
Browse files Browse the repository at this point in the history
…ponent as replaceable.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@12361 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Jul 25, 2012
1 parent 7d4e0bc commit ace5190
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Compiler/Script/Interactive.mo
Expand Up @@ -10080,11 +10080,38 @@ algorithm
str = getNamedAnnotation(className,p,"defaultComponentPrefixes",SOME("{}"),getDefaultComponentPrefixesModStr);
io = getDefaultInnerOuter(str);
redecl = getDefaultReplaceable(str);
redecl = makeReplaceableIfPartial(p, className, redecl);
attr = getDefaultAttr(str);
then(io,redecl,attr);
end match;
end getDefaultPrefixes;

protected function makeReplaceableIfPartial
"function makeReplaceableIfPartial
This function takes:
arg1 - a Program,
arg2 - the path of class,
arg3 - redeclare option.
The result is an updated redeclare option.
This function checks if the class is partial or not, if yes then it adds the replaceable keyword to the component."
input Absyn.Program p;
input Absyn.Path className;
input Option<Absyn.RedeclareKeywords> redecl;
output Option<Absyn.RedeclareKeywords> new_redecl;
algorithm
new_redecl := matchcontinue(p, className, redecl)
case (p, className, NONE())
equation
true = isPartial(className, p);
then SOME(Absyn.REPLACEABLE());
/* if the above case fails i.e class is not partial */
case (p, className, NONE())
then redecl;
case (p, className, SOME(Absyn.REPLACEABLE()))
then redecl;
end matchcontinue;
end makeReplaceableIfPartial;

protected function getDefaultInnerOuter "helper function to getDefaultPrefixes"
input String str;
output Absyn.InnerOuter io;
Expand Down

0 comments on commit ace5190

Please sign in to comment.