Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only consider Object.freeze a side effect if the argument is used (#4720
- Loading branch information
1 parent
9a74163
commit 780e342
Showing
5 changed files
with
22 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
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,4 +1,3 @@ | ||
module.exports = { | ||
description: 'supports bigint via acorn plugin', | ||
options: {} | ||
description: 'supports bigint via acorn plugin' | ||
}; |
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 = { | ||
description: 'Only treats Object.freeze as a side effect if the argument is used' | ||
}; |
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 b = Object.freeze({ foo: 'bar' }); | ||
console.log(b); | ||
|
||
const c = { foo: 'bar' }; | ||
Object.freeze(c); // retained | ||
console.log(c); |
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,11 @@ | ||
Object.freeze({ foo: 'bar' }); // removed | ||
|
||
const a = { foo: 'bar' }; // removed | ||
Object.freeze(a); // removed | ||
|
||
const b = Object.freeze({ foo: 'bar' }); | ||
console.log(b); | ||
|
||
const c = { foo: 'bar' }; | ||
Object.freeze(c); // retained | ||
console.log(c); |