Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent invalid code when removing assignment target of side-effectfu…
…l object expression (#3921)
- Loading branch information
1 parent
966bfa5
commit 2365ece
Showing
3 changed files
with
21 additions
and
2 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
4 changes: 4 additions & 0 deletions
4
test/function/samples/tree-shake-object-expression-assignment/_config.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,4 @@ | ||
module.exports = { | ||
description: | ||
'renders valid code when the target of an object expression with side-effects is tree-shaken' | ||
}; |
6 changes: 6 additions & 0 deletions
6
test/function/samples/tree-shake-object-expression-assignment/main.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 result = {}; | ||
|
||
let foo; | ||
foo = { [(result.x = 1)]: (result.y = 2) }; | ||
|
||
assert.deepStrictEqual(result, { x: 1, y: 2 }); |