private static boolean isBlockDeclOrDo(Node n) {
    if (n.isLabel()) {
      Node labeledStatement = n.getLastChild();
      if (!labeledStatement.isBlock()) {
        return isBlockDeclOrDo(labeledStatement);
      } else {
        // For labels with block children, we need to ensure that a
        // labeled FUNCTION or DO isn't generated when extraneous BLOCKs
        // are skipped.
        if (getNonEmptyChildCount(n, 2) == 1) {
          return isBlockDeclOrDo(getFirstNonEmptyChild(n));
        } else {
          // Either a empty statement or an block with more than one child,
          // way it isn't a FUNCTION or DO.
          return false;
        }
      }
    } else {
      switch (n.getToken()) {
        case LET:
        case CONST:
        case FUNCTION:
        case CLASS:
        case DO:
          return true;
        default:
          return false;
      }
    }
  }
private static boolean isBlockDeclOrDo ( Node n ) { if ( n . isLabel ( ) ) { Node labeledStatement = n . getLastChild ( ) ; if ( ! labeledStatement . isBlock ( ) ) { return isBlockDeclOrDo ( labeledStatement ) ; } else { if ( getNonEmptyChildCount ( n , 2 ) == 1 ) { return isBlockDeclOrDo ( getFirstNonEmptyChild ( n ) ) ; } else { return false ; } } } else { switch ( n . getToken ( ) ) { case LET : case CONST : case FUNCTION : case CLASS : case DO : return true ; default : return false ; } } }
@return Whether the Node is a DO or a declaration that is only allowed
in restricted contexts.