Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix object rest in array pattern (#10275)
* fix object rest in array pattern * update test fixtures * early return * use path.stop() at the right path
- Loading branch information
1 parent
8183103
commit 8027dca
Showing
9 changed files
with
179 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// ForXStatement | ||
for (const [{a, ...b}] of []) {} | ||
for ([{a, ...b}] of []) {} | ||
async function a() { | ||
for await ([{a, ...b}] of []) {} | ||
} | ||
|
||
// skip | ||
for ([{a}] in {}) {} | ||
for ([{a}] of []) {} | ||
async function a() { | ||
for await ([{a}] of []) {} | ||
} | ||
|
||
for ([a, ...b] in {}) {} | ||
for ([a, ...b] of []) {} | ||
async function a() { | ||
for await ([a, ...b] of []) {} | ||
} |
49 changes: 49 additions & 0 deletions
49
...lugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// ForXStatement | ||
for (const _ref of []) { | ||
const [_ref2] = _ref; | ||
const { | ||
a | ||
} = _ref2, | ||
b = babelHelpers.objectWithoutProperties(_ref2, ["a"]); | ||
} | ||
|
||
for (var _ref3 of []) { | ||
[_ref4] = _ref3; | ||
var { | ||
a | ||
} = _ref4, | ||
b = babelHelpers.objectWithoutProperties(_ref4, ["a"]); | ||
} | ||
|
||
async function a() { | ||
for await (var _ref5 of []) { | ||
[_ref6] = _ref5; | ||
var { | ||
a | ||
} = _ref6, | ||
b = babelHelpers.objectWithoutProperties(_ref6, ["a"]); | ||
} | ||
} // skip | ||
|
||
|
||
for ([{ | ||
a | ||
}] in {}) {} | ||
|
||
for ([{ | ||
a | ||
}] of []) {} | ||
|
||
async function a() { | ||
for await ([{ | ||
a | ||
}] of []) {} | ||
} | ||
|
||
for ([a, ...b] in {}) {} | ||
|
||
for ([a, ...b] of []) {} | ||
|
||
async function a() { | ||
for await ([a, ...b] of []) {} | ||
} |
1 change: 1 addition & 0 deletions
1
...abel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const [a, [{b, ...c}], {d, ...e}, [{ f, ...g}, {h: [i, {j, ...k}] }]] = x; |
19 changes: 19 additions & 0 deletions
19
...bel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const [a, [_ref], _ref2, [_ref3, { | ||
h: [i, _ref4] | ||
}]] = x; | ||
const { | ||
b | ||
} = _ref, | ||
c = babelHelpers.objectWithoutProperties(_ref, ["b"]), | ||
{ | ||
d | ||
} = _ref2, | ||
e = babelHelpers.objectWithoutProperties(_ref2, ["d"]), | ||
{ | ||
f | ||
} = _ref3, | ||
g = babelHelpers.objectWithoutProperties(_ref3, ["f"]), | ||
{ | ||
j | ||
} = _ref4, | ||
k = babelHelpers.objectWithoutProperties(_ref4, ["j"]); |
6 changes: 6 additions & 0 deletions
6
.../babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const [a, {b, ...c}] = x; | ||
|
||
let [d, {e, ...f}] = x; | ||
|
||
[g, {h, ...i}] = x; | ||
|
15 changes: 15 additions & 0 deletions
15
...babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const [a, _ref] = x; | ||
const { | ||
b | ||
} = _ref, | ||
c = babelHelpers.objectWithoutProperties(_ref, ["b"]); | ||
let [d, _ref2] = x; | ||
let { | ||
e | ||
} = _ref2, | ||
f = babelHelpers.objectWithoutProperties(_ref2, ["e"]); | ||
[g, _ref3] = x; | ||
var { | ||
h | ||
} = _ref3, | ||
i = babelHelpers.objectWithoutProperties(_ref3, ["h"]); |
7 changes: 3 additions & 4 deletions
7
packages/babel-preset-env/test/fixtures/corejs2/usage-for-of-destructure-with/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import "core-js/modules/es7.string.pad-end"; | ||
import "core-js/modules/es7.string.pad-start"; | ||
|
||
for (const _ref of foo) { | ||
const { | ||
padStart | ||
} = _ref; | ||
for (const { | ||
padStart | ||
} of foo) { | ||
console.log('b'.padEnd(5)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters