Skip to content

Commit

Permalink
- Rename redeclared class declarations in
Browse files Browse the repository at this point in the history
  InstExtends.updateComponentsAndClassdefs2 so that their names are correct.
- Stop iterating in Inst.matchModificationToComponents when we get an empty
  modifier.
- Added another Siemens test (not working yet).


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10667 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Dec 7, 2011
1 parent 203000f commit d9a3eb5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Compiler/FrontEnd/Inst.mo
Expand Up @@ -4043,8 +4043,8 @@ algorithm
SCode.Element elem;
String cn,s1,s2;

case({},DAE.NOMOD(),_) then ();
case({},DAE.MOD(subModLst={}),_) then ();
case(_,DAE.NOMOD(),_) then ();
case(_,DAE.MOD(subModLst={}),_) then ();

case({},inmod,callingScope)
equation
Expand Down
1 change: 1 addition & 0 deletions Compiler/FrontEnd/InstExtends.mo
Expand Up @@ -654,6 +654,7 @@ algorithm
equation
DAE.REDECL(_, _, (comp, cmod)::_) = Mod.lookupCompModification(inMod, id);
mod_rest = Mod.removeMod(inMod, id);
comp = SCode.renameElement(comp, id);
then
((comp, cmod, b), mod_rest);

Expand Down
28 changes: 28 additions & 0 deletions Compiler/FrontEnd/SCode.mo
Expand Up @@ -825,6 +825,34 @@ algorithm
end match;
end elementName;

public function renameElement
input Element inElement;
input String inName;
output Element outElement;
algorithm
outElement := match(inElement, inName)
local
Prefixes pf;
Encapsulated ep;
Partial pp;
Restriction res;
ClassDef cdef;
Absyn.Info i;
Attributes attr;
Absyn.TypeSpec ty;
Mod mod;
Option<Comment> cmt;
Option<Absyn.Exp> cond;

case (CLASS(_, pf, ep, pp, res, cdef, i), _)
then CLASS(inName, pf, ep, pp, res, cdef, i);

case (COMPONENT(_, pf, attr, ty, mod, cmt, cond, i), _)
then COMPONENT(inName, pf, attr, ty, mod, cmt, cond, i);

end match;
end renameElement;

public function enumName ""
input Enum e;
output String s;
Expand Down

0 comments on commit d9a3eb5

Please sign in to comment.