/** * Exits a statement. */ protected void exitCtStatement(CtStatement statement) { if (!(statement instanceof CtBlock || statement instanceof CtIf || statement instanceof CtFor || statement instanceof CtForEach || statement instanceof CtWhile || statement instanceof CtTry || statement instanceof CtSwitch || statement instanceof CtSynchronized || statement instanceof CtClass || statement instanceof CtComment)) { if (context.isStatement(statement) && !context.isFirstForVariable() && !context.isNextForVariable()) { printer.writeSeparator(";"); } } elementPrinterHelper.writeComment(statement, CommentOffset.AFTER); }
/** * Enters a statement. */ protected void enterCtStatement(CtStatement s) { elementPrinterHelper.writeComment(s, CommentOffset.BEFORE); getPrinterHelper().mapLine(s, sourceCompilationUnit); if (!context.isNextForVariable()) { //TODO AnnotationLoopTest#testAnnotationDeclaredInForInit expects that annotations of next for variables are not printed //but may be correct is that the next variables are not annotated, because they might have different annotation then first param! elementPrinterHelper.writeAnnotations(s); } if (!context.isFirstForVariable() && !context.isNextForVariable()) { if (s.getLabel() != null) { printer.writeIdentifier(s.getLabel()).writeSpace().writeSeparator(":").writeSpace(); } } }