Skip to content

Commit b265ebb

Browse files
committed
Fix for #2570:
- Print parentheses when dumping empty annotation with Dump module. git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19028 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 84fc523 commit b265ebb

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

Compiler/FrontEnd/Dump.mo

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,30 +1384,18 @@ end unparseAnnotationOptionSemi;
13841384

13851385
public function unparseAnnotation
13861386
"Prettyprint an annotation."
1387-
input Absyn.Annotation inAbsynAnnotation;
1388-
input Integer inInteger;
1387+
input Absyn.Annotation inAnnotation;
1388+
input Integer inIndent;
13891389
output String outString;
1390-
algorithm
1391-
outString := matchcontinue (inAbsynAnnotation,inInteger)
1392-
local
1393-
String s1,s2,str,is;
1394-
list<Absyn.ElementArg> mod;
1395-
Integer i;
1396-
case (Absyn.ANNOTATION(mod),0)
1397-
equation
1398-
s1 = unparseClassModificationStr(Absyn.CLASSMOD(mod,Absyn.NOMOD()));
1399-
s2 = stringAppend(" annotation", s1);
1400-
str = s2;
1401-
then
1402-
str;
1403-
case (Absyn.ANNOTATION(mod),i)
1404-
equation
1405-
s1 = unparseClassModificationStr(Absyn.CLASSMOD(mod,Absyn.NOMOD()));
1406-
is = indentStr(i);
1407-
str = stringAppendList({is,"annotation",s1});
1408-
then
1409-
str;
1410-
end matchcontinue;
1390+
protected
1391+
list<Absyn.ElementArg> mods;
1392+
String indent, mods_str, ann_str;
1393+
algorithm
1394+
Absyn.ANNOTATION(elementArgs = mods) := inAnnotation;
1395+
ann_str := Util.if_(intEq(inIndent, 0), " annotation", "annotation");
1396+
mods_str := List.toString(mods, unparseElementArgStr, ann_str, "(", ", ", ")", true);
1397+
indent := indentStr(inIndent);
1398+
outString := stringAppend(indent, mods_str);
14111399
end unparseAnnotation;
14121400

14131401
public function unparseAnnotationOption

0 commit comments

Comments
 (0)