object rest - fix when destructuring in variables/parameters (#4755)

* object rest - fix when destructuring in variables/parameters

* fixes + ExportNamedDeclaration support

* Account for CatchClause

* support ForXStatement

* support assignment expression? + PR fixes
This commit is contained in:
Henry Zhu
2016-11-15 11:31:03 -05:00
committed by GitHub
parent 5075f3cb6f
commit 5e0508d57c
23 changed files with 408 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
// var { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
// assert.equal(x, 1);
// assert.equal(y, 2);
// assert.deepEqual(z, { a: 3, b: 4 });
// var complex = {
// x: { a: 1, b: 2, c: 3 },
// };
// var {
// x: { a: xa, ...xbc }
// } = complex;
// assert.equal(xa, 1);
// assert.deepEqual(xbc, { b: 2, c: 3});
// // own properties
// function ownX({ ...properties }) {
// return properties.x;
// }
// assert.equal(ownX(Object.create({ x: 1 })), undefined);

View File

@@ -0,0 +1,3 @@
{
"plugins": ["transform-object-rest-spread"]
}