Skip to content

Commit

Permalink
Fixed bugs in unparsing of enumeration literals:
Browse files Browse the repository at this point in the history
- Allow enumerations with only one enumerator/literal.
- Do not print a space after last literal if no comment is available.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15328 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Daniel Hedberg committed Feb 26, 2013
1 parent a81e91a commit 06f4d98
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Compiler/FrontEnd/Dump.mo
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ protected function unparseEnumliterals
algorithm
outString := matchcontinue (inAbsynEnumLiteralLst)
local
Ident s1,s2,res,str,str2;
Option<Absyn.Comment> optcmt,optcmt2;
Ident s1,s2,res,str;
Option<Absyn.Comment> optcmt;
Absyn.EnumLiteral a;
list<Absyn.EnumLiteral> b;

Expand All @@ -511,14 +511,15 @@ algorithm
then
res;

case ({Absyn.ENUMLITERAL(literal = str,comment = optcmt),Absyn.ENUMLITERAL(literal = str2,comment = optcmt2)})
case ({Absyn.ENUMLITERAL(literal = str,comment = NONE())}) then str;
case ({Absyn.ENUMLITERAL(literal = str,comment = optcmt as SOME(_))})
equation
s1 = unparseCommentOption(optcmt);
s2 = unparseCommentOption(optcmt2);
res = stringAppendList({str," ",s1,", ",str2," ",s2});
res = stringAppendList({str," ",s1});
then
res;
end matchcontinue;

end matchcontinue;
end unparseEnumliterals;

protected function printEnumliterals
Expand Down

0 comments on commit 06f4d98

Please sign in to comment.