void (@NotNull GrForStatement forStatement) { builder.append("for("); final GrForClause clause = forStatement.getClause(); ExpressionContext forContext = context.extend(); if (clause instanceof GrForInClause) { final GrExpression expression = ((GrForInClause)clause).getIteratedExpression(); final GrVariable declaredVariable = ((GrForInClause)clause).getDeclaredVariable(); LOG.assertTrue(declaredVariable != null); writeVariableWithoutSemicolonAndInitializer(builder, declaredVariable, context); builder.append(" : "); if (expression != null) { final ExpressionContext context = forContext.copy(); writeExpression(expression, builder, context); } } else if (clause instanceof GrTraditionalForClause cl) { final GrCondition initialization = cl.getInitialization(); final GrExpression condition = cl.getCondition(); final GrExpressionList update = cl.getUpdate(); if (initialization instanceof GrParameter) { StringBuilder partBuilder = new StringBuilder(); writeVariableWithoutSemicolonAndInitializer(partBuilder, (GrParameter)initialization, context); final GrExpression initializer = ((GrParameter)initialization).getInitializerGroovy(); if (initializer != null) { final ExpressionContext partContext = forContext.copy(); partBuilder.append(" = "); writeExpression(initializer, partBuilder, partContext); for (String statement : partContext.myStatements) { builder.append(statement).append(", "); } builder.append(partBuilder); } } else if (initialization != null) { genForPart(builder, initialization, new CodeBlockGenerator(new StringBuilder(), forContext.copy(), null)); } if (condition != null) { genForPart(builder, condition, new ExpressionGenerator(new StringBuilder(), forContext.copy())); } builder.append(';'); if (update != null) { genForPart(builder, update, new ExpressionGenerator(new StringBuilder(), forContext.copy())); } } builder.append(')'); final GrStatement body = forStatement.getBody(); if (body != null) { body.accept(new CodeBlockGenerator(builder, forContext, null)); } }