void (StringBuilder builder, ExpressionContext context) { if (caseSections.length == 1 && caseSections[0].isDefault()) { builder.append("if(true)"); } GrCaseSection section = caseSections[i]; if (section.getStatements().length != 0) { final boolean isCase = currentSequentialSectionFrame.size() > 1 || !section.isDefault(); if (isCase) { writeCondition(builder, context, section, currentSequentialSectionFrame, args); } writeCaseBody(builder, context, i, caseSections); if (isCase && i != caseSections.length - 1) { builder.append("\nelse "); StringBuilder elseBuilder = new StringBuilder(); final ExpressionContext elseContext = context.extend(); generateIfFromCaseSection(elseBuilder, elseContext, caseSections, i + 1, List.of(), args); GenerationUtil.insertStatementFromContextBefore(builder, elseContext); builder.append(elseBuilder); } if (!context.myStatements.isEmpty()) { context.setInsertCurlyBrackets(); } } else { var list = new ArrayList<>(currentSequentialSectionFrame); list.add(section); generateIfFromCaseSection(builder, context, caseSections, i + 1, list, args); } }