Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/minifier): Don't ignore nullish coalescing (#6272)
- Loading branch information
Showing
12 changed files
with
18 additions
and
23 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
crates/swc/tests/tsc-references/logicalAssignment1(target=es2020).2.minified.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,2 +1,2 @@ | ||
//// [logicalAssignment1.ts] | ||
a && (a = "foo"), b || (b = "foo"), c = "foo", d && (d = 42), e || (e = 42), f = 42, g && (g = 42), h || (h = 42), i = 42; | ||
a && (a = "foo"), b || (b = "foo"), c ?? (c = "foo"), d && (d = 42), e || (e = 42), f ?? (f = 42), g && (g = 42), h || (h = 42), i ?? (i = 42); |
4 changes: 2 additions & 2 deletions
4
crates/swc/tests/tsc-references/logicalAssignment10(target=es2020).2.minified.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,5 +1,5 @@ | ||
//// [logicalAssignment10.ts] | ||
var _obj, _ref, _ref1, _ref2, count = 0, obj = {}; | ||
(_obj = obj)[_ref = ++count], _obj[_ref] = ++count, (_ref1 = ({ | ||
(_obj = obj)[_ref = ++count] ?? (_obj[_ref] = ++count), (_ref1 = ({ | ||
obj | ||
}).obj)[_ref2 = ++count], _ref1[_ref2] = ++count; | ||
}).obj)[_ref2 = ++count] ?? (_ref1[_ref2] = ++count); |
4 changes: 2 additions & 2 deletions
4
crates/swc/tests/tsc-references/logicalAssignment11(target=es2020).2.minified.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 @@ | ||
//// [logicalAssignment11.ts] | ||
let x; | ||
(x ?? "x").length, (x ?? "x").length; | ||
let x, d, e; | ||
d ?? (d = x ?? "x"), d.length, e ?? (e = x ?? "x"), e.length; |
4 changes: 2 additions & 2 deletions
4
crates/swc/tests/tsc-references/logicalAssignment11(target=es2022).2.minified.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 @@ | ||
//// [logicalAssignment11.ts] | ||
let x, e; | ||
(x ?? "x").length, (e ??= x ?? "x").length; | ||
let x, d, e; | ||
d ?? (d = x ?? "x"), d.length, (e ??= x ?? "x").length; |
2 changes: 1 addition & 1 deletion
2
crates/swc/tests/tsc-references/logicalAssignment2(target=es2020).2.minified.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
crates/swc/tests/tsc-references/logicalAssignment3(target=es2020).2.minified.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 @@ | ||
//// [logicalAssignment3.ts] | ||
var _a, _b, _c; | ||
(_a = a).baz && (_a.baz = result.baz), (_b = b).baz || (_b.baz = result.baz), (_c = c).baz, _c.baz = result.baz; | ||
(_a = a).baz && (_a.baz = result.baz), (_b = b).baz || (_b.baz = result.baz), (_c = c).baz ?? (_c.baz = result.baz); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a ?? (a = b); |
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 @@ | ||
a ?? (a = b); |
8c1ac68
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
es/full/bugs-1
422553
ns/iter (± 35040
)422834
ns/iter (± 9314
)1.00
es/full/minify/libraries/antd
2074136495
ns/iter (± 84790422
)2117587486
ns/iter (± 30025778
)0.98
es/full/minify/libraries/d3
469995321
ns/iter (± 37946248
)436897321
ns/iter (± 6701703
)1.08
es/full/minify/libraries/echarts
1715074849
ns/iter (± 111971530
)1803085905
ns/iter (± 26670189
)0.95
es/full/minify/libraries/jquery
128041674
ns/iter (± 9408195
)117054659
ns/iter (± 2857828
)1.09
es/full/minify/libraries/lodash
155130241
ns/iter (± 21594048
)139036877
ns/iter (± 5653043
)1.12
es/full/minify/libraries/moment
91183362
ns/iter (± 10031001
)70168163
ns/iter (± 762921
)1.30
es/full/minify/libraries/react
28343139
ns/iter (± 3613934
)23961908
ns/iter (± 751109
)1.18
es/full/minify/libraries/terser
450190118
ns/iter (± 101770297
)327957864
ns/iter (± 7714803
)1.37
es/full/minify/libraries/three
735889385
ns/iter (± 198894852
)595485634
ns/iter (± 5443993
)1.24
es/full/minify/libraries/typescript
4401625514
ns/iter (± 274647832
)3966903053
ns/iter (± 31507120
)1.11
es/full/minify/libraries/victory
1093032888
ns/iter (± 170596397
)902347064
ns/iter (± 26898522
)1.21
es/full/minify/libraries/vue
230265071
ns/iter (± 83991406
)175757596
ns/iter (± 4183269
)1.31
es/full/codegen/es3
38632
ns/iter (± 6795
)40484
ns/iter (± 1027
)0.95
es/full/codegen/es5
39043
ns/iter (± 10430
)40774
ns/iter (± 751
)0.96
es/full/codegen/es2015
39171
ns/iter (± 3958
)40773
ns/iter (± 1179
)0.96
es/full/codegen/es2016
39965
ns/iter (± 5447
)40764
ns/iter (± 840
)0.98
es/full/codegen/es2017
38487
ns/iter (± 6334
)40748
ns/iter (± 1260
)0.94
es/full/codegen/es2018
38205
ns/iter (± 7458
)40827
ns/iter (± 538
)0.94
es/full/codegen/es2019
39241
ns/iter (± 14438
)40790
ns/iter (± 931
)0.96
es/full/codegen/es2020
39217
ns/iter (± 3508
)40752
ns/iter (± 1072
)0.96
es/full/all/es3
264957445
ns/iter (± 83751900
)233077522
ns/iter (± 3281389
)1.14
es/full/all/es5
233424770
ns/iter (± 55331811
)219348161
ns/iter (± 4784940
)1.06
es/full/all/es2015
180627367
ns/iter (± 56300368
)177308360
ns/iter (± 2885609
)1.02
es/full/all/es2016
183157086
ns/iter (± 70558860
)175525647
ns/iter (± 4946368
)1.04
es/full/all/es2017
187879457
ns/iter (± 61924798
)176016690
ns/iter (± 4007006
)1.07
es/full/all/es2018
180862070
ns/iter (± 33282267
)174026883
ns/iter (± 2865738
)1.04
es/full/all/es2019
179318277
ns/iter (± 99456908
)173266700
ns/iter (± 5250737
)1.03
es/full/all/es2020
177289500
ns/iter (± 28671410
)167528772
ns/iter (± 5349121
)1.06
es/full/parser
807085
ns/iter (± 89320
)871919
ns/iter (± 21553
)0.93
es/full/base/fixer
28651
ns/iter (± 2793
)32100
ns/iter (± 632
)0.89
es/full/base/resolver_and_hygiene
101931
ns/iter (± 18043
)114006
ns/iter (± 4104
)0.89
serialization of ast node
226
ns/iter (± 15
)257
ns/iter (± 2
)0.88
serialization of serde
228
ns/iter (± 40
)259
ns/iter (± 10
)0.88
This comment was automatically generated by workflow using github-action-benchmark.