code: private void replacePattern(
        NodeTraversal t, Node pattern, Node rhs, Node parent, Node nodeToDetach) {
      checkArgument(NodeUtil.isStatement(nodeToDetach), nodeToDetach);
      switch (pattern.getToken()) {
        case ARRAY_PATTERN:
          replaceArrayPattern(t, pattern, rhs, parent, nodeToDetach);
          break;
        case OBJECT_PATTERN:
          replaceObjectPattern(t, pattern, rhs, parent, nodeToDetach);
          break;
        default:
          throw new IllegalStateException("unexpected");
      }
    }
docs: Transpiles a destructuring pattern in a declaration or assignment to ES5
  
  @param nodeToDetach a statement node containing the pattern. This method will replace the node
  with one or more other statements.