Node createDestructuringAssignment ( int type , Node left , Node right ) { String tempName = currentScriptOrFn . getNextTempName ( ) ; Node result = destructuringAssignmentHelper ( type , left , right , tempName ) ; Node comma = result . getLastChild ( ) ; comma . addChildToBack ( createName ( tempName ) ) ; return result ; }
Given a destructuring assignment with a left hand side parsed as an array or object literal and a right hand side expression rewrite as a series of assignments to the variables defined in left from property accesses to the expression on the right .