@Override
  public void deleteChildInternal(@NotNull ASTNode child) {
    if (DECLARED_ELEMENT_BIT_SET.contains(child.getElementType())) {
      PsiElement[] declaredElements = getDeclaredElements();
      int length = declaredElements.length;

      if (length == 1) {
        getTreeParent().deleteChildInternal(this);
        return;
      }

      if (length > 0) {
        if (SourceTreeToPsiMap.psiElementToTree(declaredElements[length - 1]) == child) {
          removeCommaBefore(child);
          CharTable charTable = SharedImplUtil.findCharTableByTree(this);
          LeafElement semicolon = Factory.createSingleLeafElement(JavaTokenType.SEMICOLON, ";", charTable, getManager());
          SourceTreeToPsiMap.psiToTreeNotNull(declaredElements[length - 2]).addChild(semicolon, null);
        }
        else if (SourceTreeToPsiMap.psiElementToTree(declaredElements[0]) == child) {
          CompositeElement next = (CompositeElement)SourceTreeToPsiMap.psiToTreeNotNull(declaredElements[1]);
          ASTNode copyChild = child.copyElement();
          ASTNode nameChild = ((CompositeElement)copyChild).findChildByRole(ChildRole.NAME);
          assert nameChild != null;
          removeCommaBefore(next);
          next.addInternal((TreeElement)copyChild.getFirstChildNode(), nameChild.getTreePrev(), null, Boolean.FALSE);
        }
        else {
          removeCommaBefore(child);
        }
      }
    }

    super.deleteChildInternal(child);

    TreeElement first = getFirstChildNode();
    if (first != null && !DECLARED_ELEMENT_BIT_SET.contains(first.getElementType())) {
      TreeElement last = first;
      while (true) {
        TreeElement next = last.getTreeNext();
        if (next == null || DECLARED_ELEMENT_BIT_SET.contains(next.getElementType())) break;
        last = next;
      }
      getTreeParent().addInternal(first, last, this, Boolean.TRUE);
    }
  }
@Override
  public void deleteChildInternal(@NotNull ASTNode child)