Skip to content

Commit

Permalink
Preserve function comments and annotations for external functions
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15914 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Apr 25, 2013
1 parent 302ba78 commit 193aecc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Compiler/FrontEnd/Inst.mo
Original file line number Diff line number Diff line change
Expand Up @@ -12402,14 +12402,15 @@ algorithm
SCode.Element c;
DAE.Type ty1,ty;
SCode.Prefixes prefixes;
Option<SCode.Comment> comment;

// The function type can be determined without the body. Annotations need to be preserved though.
case (cache,env,ih,SCode.CLASS(name = id,prefixes = prefixes,
encapsulatedPrefix = e,partialPrefix = p,restriction = r,
classDef = SCode.PARTS(elementLst = elts,annotationLst=annotationLst,externalDecl=extDecl),info = info))
classDef = SCode.PARTS(elementLst = elts,annotationLst=annotationLst,externalDecl=extDecl,comment=comment),info = info))
equation
stripped_elts = List.map(elts,stripFuncOutputsMod);
stripped_class = SCode.CLASS(id,prefixes,e,p,r,SCode.PARTS(elts,{},{},{},{},{},{},extDecl,annotationLst,NONE()),info);
stripped_class = SCode.CLASS(id,prefixes,e,p,r,SCode.PARTS(elts,{},{},{},{},{},{},extDecl,annotationLst,comment),info);
(cache,env_1,ih,funs) = implicitFunctionInstantiation2(cache, env, ih, DAE.NOMOD(), Prefix.NOPRE(), stripped_class, {}, true);
// Only external functions are valid without an algorithm section...
cache = Env.addDaeExtFunction(cache, funs);
Expand Down
7 changes: 7 additions & 0 deletions Compiler/FrontEnd/SCodeDump.mo
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ algorithm
outString := Tpl.tplString(SCodeDumpTpl.dumpProgram, inProgram);
end programStr;

public function classDefStr
input SCode.ClassDef cd;
output String outString;
algorithm
outString := Tpl.tplString(SCodeDumpTpl.dumpClassDef, cd);
end classDefStr;

public function statementStr
input SCode.Statement stmt;
output String outString;
Expand Down

0 comments on commit 193aecc

Please sign in to comment.