babel/packages/babel-plugin-transform-destructuring
Moti Zilberman f7bfc774ba Destructuring: Fix array unpacking assignments with holes on RHS (#9412)
This fixes an issue where destructuring assignments eligible for the "array unpacking" optimization would fail to compile when the array literal on the right-hand side of the expression contained holes.

Example input:
```js
[a, b] = [, 2];
; // Avoid completion record special case
```

The error message was `Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got null`.

Now the above code compiles to:
```js
a = void 0;
b = 2;
;
```

This PR also adds a couple of related test cases that were missing, to ensure the change doesn't regress them:
* Normal assignment expression with unpacking
* Declaration with unpacking and a hole on RHS
2019-03-27 01:14:21 +01:00
..
2019-03-19 21:27:16 +01:00

@babel/plugin-transform-destructuring

Compile ES2015 destructuring to ES5

See our website @babel/plugin-transform-destructuring for more information.

Install

Using npm:

npm install --save-dev @babel/plugin-transform-destructuring

or using yarn:

yarn add @babel/plugin-transform-destructuring --dev