void (GrVariableDeclaration variableDeclaration, StringBuilder builder, ExpressionContext expressionContext) { GrVariable[] variables = variableDeclaration.getVariables(); final GrExpression tupleInitializer = variableDeclaration.getTupleInitializer(); if (tupleInitializer instanceof GrListOrMap) { for (GrVariable variable : variables) { GenerationUtil.writeVariableSeparately(variable, builder, expressionContext); builder.append(";\n"); } } else if (tupleInitializer != null) { GroovyResolveResult iteratorMethodResult = GenerationUtil .resolveMethod(tupleInitializer, "iterator", GrExpression.EMPTY_ARRAY, GrNamedArgument.EMPTY_ARRAY, GrClosableBlock.EMPTY_ARRAY, variableDeclaration); final PsiType iteratorType = inferIteratorType(iteratorMethodResult, tupleInitializer); final String iteratorName = genIteratorVar(variableDeclaration, builder, expressionContext, tupleInitializer, iteratorType, iteratorMethodResult); final GrModifierList modifierList = variableDeclaration.getModifierList(); PsiType iterableTypeParameter = PsiUtil.extractIterableTypeParameter(iteratorType, false); for (final GrVariable v : variables) { ModifierListGenerator.writeModifiers(builder, modifierList); final PsiType type = context.typeProvider.getVarType(v); TypeWriter.writeType(builder, type, variableDeclaration); builder.append(' ').append(v.getName()); builder.append(" = "); GenerationUtil.wrapInCastIfNeeded(builder, type, iterableTypeParameter, tupleInitializer, expressionContext, new StatementWriter() { @Override public void writeStatement(StringBuilder builder, ExpressionContext context) { builder.append(iteratorName).append(".hasNext() ? ").append(iteratorName).append(".next() : null"); } }); builder.append(";\n"); } } else { GenerationUtil.writeSimpleVarDeclaration(variableDeclaration, builder, expressionContext); } }