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" ) ; } }
Transpiles a destructuring pattern in a declaration or assignment to ES5