Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add case for respecting side-effect of getter and setter
- Loading branch information
Showing
6 changed files
with
68 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1369,3 +1369,4 @@ ychannelselector | |
yield | ||
zoomAndPan | ||
zoomandpan | ||
__proto__ |
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
5 changes: 5 additions & 0 deletions
5
crates/swc_ecma_minifier/tests/fixture/issues/6422/1/config.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,5 @@ | ||
{ | ||
"collapse_vars": true, | ||
"unused": true, | ||
"toplevel": true | ||
} |
21 changes: 21 additions & 0 deletions
21
crates/swc_ecma_minifier/tests/fixture/issues/6422/1/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,21 @@ | ||
let getter_effect = 'FAIL'; | ||
let setter_effect = 'FAIL'; | ||
let proto = { | ||
get foo() { | ||
getter_effect = 'PASS'; | ||
}, | ||
set bar(value) { | ||
setter_effect = 'PASS'; | ||
} | ||
}; | ||
let obj1 = { | ||
__proto__: proto | ||
}; | ||
let obj2 = { | ||
__proto__: proto | ||
}; | ||
let unused = obj1.foo; | ||
obj2.bar = 0; | ||
|
||
assert.strictEqual(getter_effect, 'PASS'); | ||
assert.strictEqual(setter_effect, 'PASS'); |
18 changes: 18 additions & 0 deletions
18
crates/swc_ecma_minifier/tests/fixture/issues/6422/1/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,18 @@ | ||
let getter_effect = 'FAIL'; | ||
let setter_effect = 'FAIL'; | ||
let proto = { | ||
get foo () { | ||
getter_effect = 'PASS'; | ||
}, | ||
set bar (value){ | ||
setter_effect = 'PASS'; | ||
} | ||
}; | ||
({ | ||
__proto__: proto | ||
}).foo; | ||
({ | ||
__proto__: proto | ||
}).bar = 0; | ||
assert.strictEqual(getter_effect, 'PASS'); | ||
assert.strictEqual(setter_effect, 'PASS'); |
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