String (@NotNull StringBuilder builder, @NotNull ExpressionContext context, @NotNull GrExpression condition) { StringBuilder conditionBuilder = new StringBuilder(); final PsiType type = condition.getType(); final String varName = GenerationUtil.validateName("switchArg", condition, context); conditionBuilder.append("final "); TypeWriter.writeType(conditionBuilder, type, condition); conditionBuilder.append(' ').append(varName).append(" = "); condition.accept(new ExpressionGenerator(conditionBuilder, context)); conditionBuilder.append(";\n"); GenerationUtil.insertStatementFromContextBefore(builder, context); builder.append(conditionBuilder); return varName; }