-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix more variable deconflicting issues (#5728)
* Ensure we also include declared variables if they are included for a key or default side effect * Always include full array patterns
- Loading branch information
1 parent
aaf38b7
commit 6c68455
Showing
15 changed files
with
88 additions
and
9 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
3 changes: 3 additions & 0 deletions
3
...on/samples/object-expression-treeshaking/deconflict-destructured-array-pattern/_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,3 @@ | ||
module.exports = defineTest({ | ||
description: 'makes sure to deconflict all variables in an array pattern if included' | ||
}); |
2 changes: 2 additions & 0 deletions
2
...nction/samples/object-expression-treeshaking/deconflict-destructured-array-pattern/dep.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,2 @@ | ||
const Foo = { ok: true }; | ||
export { Foo as default }; |
6 changes: 6 additions & 0 deletions
6
...ction/samples/object-expression-treeshaking/deconflict-destructured-array-pattern/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 @@ | ||
import bar from './dep.js'; | ||
|
||
const [Foo, Bar] = [1, 2]; | ||
|
||
assert.deepStrictEqual(bar, { ok: true }); | ||
assert.deepStrictEqual(Bar, 2); |
4 changes: 4 additions & 0 deletions
4
...-expression-treeshaking/deconflict-destructured-for-default-side-effects-array/_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 = defineTest({ | ||
description: | ||
'makes sure to deconflict variables that are destructured for side effects in their array pattern default values only' | ||
}); |
2 changes: 2 additions & 0 deletions
2
...ject-expression-treeshaking/deconflict-destructured-for-default-side-effects-array/dep.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,2 @@ | ||
const Foo = { ok: true }; | ||
export { Foo as default }; |
9 changes: 9 additions & 0 deletions
9
...ect-expression-treeshaking/deconflict-destructured-for-default-side-effects-array/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,9 @@ | ||
import bar from './dep.js'; | ||
let mutated = false; | ||
const [ | ||
Foo = (() => { | ||
mutated = true; | ||
})() | ||
] = []; | ||
assert.ok(mutated); | ||
assert.deepStrictEqual(bar, { ok: true }); |
4 changes: 4 additions & 0 deletions
4
...object-expression-treeshaking/deconflict-destructured-for-default-side-effects/_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 = defineTest({ | ||
description: | ||
'makes sure to deconflict variables that are destructured for side effects in their default values only' | ||
}); |
2 changes: 2 additions & 0 deletions
2
...les/object-expression-treeshaking/deconflict-destructured-for-default-side-effects/dep.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,2 @@ | ||
const Foo = { ok: true }; | ||
export { Foo as default }; |
9 changes: 9 additions & 0 deletions
9
...es/object-expression-treeshaking/deconflict-destructured-for-default-side-effects/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,9 @@ | ||
import bar from './dep.js'; | ||
let mutated = false; | ||
const { | ||
Foo = (() => { | ||
mutated = true; | ||
})() | ||
} = {}; | ||
assert.ok(mutated); | ||
assert.deepStrictEqual(bar, { ok: true }); |
4 changes: 4 additions & 0 deletions
4
...les/object-expression-treeshaking/deconflict-destructured-for-key-side-effects/_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 = defineTest({ | ||
description: | ||
'makes sure to deconflict variables that are destructured for side effects in their key only' | ||
}); |
2 changes: 2 additions & 0 deletions
2
...samples/object-expression-treeshaking/deconflict-destructured-for-key-side-effects/dep.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,2 @@ | ||
const Foo = { ok: true }; | ||
export { Foo as default }; |
10 changes: 10 additions & 0 deletions
10
...amples/object-expression-treeshaking/deconflict-destructured-for-key-side-effects/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,10 @@ | ||
import bar from './dep.js'; | ||
let mutated = false; | ||
const { | ||
[(() => { | ||
mutated = true; | ||
return 'Foo'; | ||
})()]: Foo | ||
} = { Foo: true }; | ||
assert.ok(mutated); | ||
assert.deepStrictEqual(bar, { ok: true }); |