private static void generateIfFromCaseSection(@NotNull StringBuilder builder,
                                                @NotNull ExpressionContext context,
                                                final GrCaseSection @NotNull [] caseSections,
                                                final int i,
                                                final List<GrCaseSection> currentSequentialSectionFrame,
                                                final GrExpression @NotNull [] args) {

    GenerationUtil.writeStatement(builder, context, null, new StatementWriter() {
      @Override
      public void writeStatement(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);
        }
      }
    });
  }
private static void generateIfFromCaseSection(@NotNull StringBuilder builder,
                                                @NotNull ExpressionContext context,
                                                final GrCaseSection @NotNull [] caseSections,
                                                final int i,
                                                final List<GrCaseSection> currentSequentialSectionFrame,
                                                final GrExpression @NotNull [] args)