src/com/google/javascript/jscomp/NodeUtil.java
/**
   * Merge a block with its parent block.
   * @return Whether the block was removed.
   */
Merge a block with its parent block.
@return Whether the block was removed.
Merge a block with its parent block . @return Whether the block was removed .
public static boolean tryMergeBlock(Node block, boolean alwaysMerge) {
    checkState(block.isBlock());
    Node parent = block.getParent();
    boolean canMerge = alwaysMerge || canMergeBlock(block);
    if (isStatementBlock(parent) && canMerge) {
      Node previous = block;
      while (block.hasChildren()) {
        Node child = block.removeFirstChild();
        parent.addChildAfter(child, previous);
        previous = child;
      }
      parent.removeChild(block);
      return true;
    } else {
      return false;
    }
  }
public static boolean tryMergeBlock ( Node block , boolean alwaysMerge ) { checkState ( block . isBlock ( ) ) ; Node parent = block . getParent ( ) ; boolean canMerge = alwaysMerge || canMergeBlock ( block ) ; if ( isStatementBlock ( parent ) && canMerge ) { Node previous = block ; while ( block . hasChildren ( ) ) { Node child = block . removeFirstChild ( ) ; parent . addChildAfter ( child , previous ) ; previous = child ; } parent . removeChild ( block ) ; return true ; } else { return false ; } }
Merge a block with its parent block.
Merge a block with its parent block .
// Try to remove the block if its parent is a block/script or if its // parent is label and it has exactly one child.