private static void dumpBody(SwitchStatementBranch branch, @NonNls StringBuilder out, CommentTracker commentTracker) {
    final List<PsiElement> bodyStatements = branch.getBodyElements();
    out.append('{');
    if (!bodyStatements.isEmpty()) {
      PsiElement firstBodyElement = bodyStatements.get(0);
      PsiElement prev = PsiTreeUtil.skipWhitespacesAndCommentsBackward(firstBodyElement);
      if (prev instanceof PsiSwitchLabelStatementBase labelStatement) {
        PsiCaseLabelElementList values = labelStatement.getCaseLabelElementList();
        if (values != null) {
          out.append(CommentTracker.commentsBetween(values, firstBodyElement));
        }
      }
    }
    for (PsiElement element : branch.getPendingDeclarations()) {
      if (ReferencesSearch.search(element, new LocalSearchScope(bodyStatements.toArray(PsiElement.EMPTY_ARRAY))).findFirst() != null) {
        if (element instanceof PsiVariable var) {
          out.append(var.getType().getCanonicalText()).append(' ').append(var.getName()).append(';');
        }
        else {
          // Class
          out.append(element.getText());
        }
      }
    }

    for (PsiElement bodyStatement : bodyStatements) {
      if (bodyStatement instanceof PsiBlockStatement blockStatement) {
        final PsiCodeBlock codeBlock = blockStatement.getCodeBlock();
        PsiElement start = PsiTreeUtil.skipWhitespacesForward(codeBlock.getLBrace());
        PsiElement end = PsiTreeUtil.skipWhitespacesBackward(codeBlock.getRBrace());
        if (start != null && end != null && start != codeBlock.getRBrace()) {
          for (PsiElement child = start; child != null; child = child.getNextSibling()) {
            out.append(commentTracker.text(child));
            if (child == end) break;
          }
        }
      }
      else {
        out.append(commentTracker.text(bodyStatement));
      }
    }
    out.append("\n").append("}");
  }
private static void dumpBody(SwitchStatementBranch branch, @NonNls StringBuilder out, CommentTracker commentTracker)