Skip to content

Commit

Permalink
Merge pull request #495 from ZeligsoftDev/streams/v2-issues/493
Browse files Browse the repository at this point in the history
Issue #493: change IDL generation replacing //@top-level with @nested
  • Loading branch information
eposse authored Feb 22, 2024
2 parents c456fe0 + 15bf14a commit e377c6b
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,13 @@ public Object caseUnionType(UnionType object) {
@Override
public Object caseStructType(StructType object) {

String commentString = "//@top-level false";
boolean nested = true;

EAnnotation annotation = object.getEAnnotation(AnnotationUtil.ZCX_ANNOTATION);
if( annotation != null ) {
if (annotation != null) {
String topLevel = annotation.getDetails().get("toplevel");
if( topLevel != null && topLevel.matches("true")) {
commentString = "//@top-level true";
if (topLevel != null && topLevel.matches("true")) {
nested = false;
}
}

Expand All @@ -363,10 +363,15 @@ public Object caseStructType(StructType object) {

// if AXCIOMA
String extensibility = "@final";
if(object.isIsAppendable()) {
if (object.isIsAppendable()) {
extensibility = "@appendable";
}
buf.append(String.format("%s%s%n", indentString, extensibility));
String nestedAnnotation = "@nested(FALSE)";
if (nested) {
nestedAnnotation = "@nested(TRUE)";
}
buf.append(String.format("%s%s%n", indentString, nestedAnnotation));

buf.append(String.format("%sstruct %s {%n",
indentString,
Expand All @@ -376,8 +381,8 @@ public Object caseStructType(StructType object) {
doSwitch(m);
}
popScope();
buf.append(String.format("%s}; %s%n",
indentString, commentString));
buf.append(String.format("%s}; %n",
indentString));
conditionalNewLine();
return buf.toString();
}
Expand Down

0 comments on commit e377c6b

Please sign in to comment.