void (@NotNull final GrExpression expression) { writeStatement(expression, new StatementWriter() { @Override public void writeStatement(StringBuilder builder, ExpressionContext context) { if (myExitPoints.contains(expression) && isRealExpression(expression)) { writeReturn(builder, context, expression); } else { writeExpression(expression, builder, context); builder.append(';'); } } private static boolean isRealExpression(GrExpression expression) { final PsiType type = expression.getType(); if (PsiTypes.voidType().equals(type)) return false; //statement if (type == PsiTypes.nullType()) return !org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil.isVoidMethodCall(expression); return true; } }); }