Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow rest object destructuring of null/undefined (#14985)
- Loading branch information
1 parent
593fd9e
commit 4748947
Showing
29 changed files
with
117 additions
and
51 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
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
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
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
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
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
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
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
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
6 changes: 3 additions & 3 deletions
6
...babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-order/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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
const bar = babelHelpers.extends({}, obj.a), | ||
baz = babelHelpers.extends({}, obj.b), | ||
foo = babelHelpers.extends({}, obj); | ||
const bar = babelHelpers.extends({}, (babelHelpers.objectDestructuringEmpty(obj.a), obj.a)), | ||
baz = babelHelpers.extends({}, (babelHelpers.objectDestructuringEmpty(obj.b), obj.b)), | ||
foo = babelHelpers.extends({}, (babelHelpers.objectDestructuringEmpty(obj), obj)); |
7 changes: 7 additions & 0 deletions
7
...-rest-spread/test/fixtures/object-rest/null-destructuring-transform-destructuring/exec.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,7 @@ | ||
expect(() => { | ||
var { ...x } = null; | ||
}).toThrow(/null/); | ||
|
||
expect(() => { | ||
var { x, ...y } = null; | ||
}).toThrow(/null/); |
7 changes: 7 additions & 0 deletions
7
...rest-spread/test/fixtures/object-rest/null-destructuring-transform-destructuring/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,7 @@ | ||
expect(() => { | ||
var { ...x } = null; | ||
}).toThrow(/null/); | ||
|
||
expect(() => { | ||
var { x, ...y } = null; | ||
}).toThrow(/null/); |
6 changes: 6 additions & 0 deletions
6
...-spread/test/fixtures/object-rest/null-destructuring-transform-destructuring/options.json
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 @@ | ||
{ | ||
"plugins": ["proposal-object-rest-spread", "transform-destructuring"], | ||
"targets": { | ||
"browsers": "ie 6" | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...est-spread/test/fixtures/object-rest/null-destructuring-transform-destructuring/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,10 @@ | ||
const _excluded = ["x"]; | ||
expect(() => { | ||
var _ref = null, | ||
x = babelHelpers.extends({}, (babelHelpers.objectDestructuringEmpty(_ref), _ref)); | ||
}).toThrow(/null/); | ||
expect(() => { | ||
var _ref2 = null, | ||
x = _ref2.x, | ||
y = babelHelpers.objectWithoutProperties(_ref2, _excluded); | ||
}).toThrow(/null/); |
7 changes: 7 additions & 0 deletions
7
...l-plugin-proposal-object-rest-spread/test/fixtures/object-rest/null-destructuring/exec.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,7 @@ | ||
expect(() => { | ||
var { ...x } = null; | ||
}).toThrow(/null/); | ||
|
||
expect(() => { | ||
var { x, ...y } = null; | ||
}).toThrow(/null/); |
7 changes: 7 additions & 0 deletions
7
...-plugin-proposal-object-rest-spread/test/fixtures/object-rest/null-destructuring/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,7 @@ | ||
expect(() => { | ||
var { ...x } = null; | ||
}).toThrow(/null/); | ||
|
||
expect(() => { | ||
var { x, ...y } = null; | ||
}).toThrow(/null/); |
12 changes: 12 additions & 0 deletions
12
...plugin-proposal-object-rest-spread/test/fixtures/object-rest/null-destructuring/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,12 @@ | ||
const _excluded = ["x"]; | ||
expect(() => { | ||
var _ref = null, | ||
x = babelHelpers.extends({}, (babelHelpers.objectDestructuringEmpty(_ref), _ref)); | ||
}).toThrow(/null/); | ||
expect(() => { | ||
var _ref2 = null, | ||
{ | ||
x | ||
} = _ref2, | ||
y = babelHelpers.objectWithoutProperties(_ref2, _excluded); | ||
}).toThrow(/null/); |
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
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
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
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
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
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
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
Oops, something went wrong.