-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/compat): Fix consecutive optional call (#6461)
- Loading branch information
Showing
15 changed files
with
90 additions
and
59 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: 2 additions & 2 deletions
4
crates/swc/tests/tsc-references/controlFlowOptionalChain.2.minified.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 +1,15 @@ | ||
//// [deleteChain.ts] | ||
var _o3_b, _o3_b1, _o4_b, _ref, _o4_b1, _ref1, _o4_b2, _ref2, _o5_b, _ref3, _o5_b1, _ref4, _o6_b, _ref5, _o6_b1, _ref6; | ||
var _o3_b, _o3_b1, _o4_b_c_d, _o4_b, _o4_b_c_d1, _o4_b1, _o4_b_c_d2, _o4_b2, _o5_b_c_d, _o5_b, _o5_b_c_d1, _o5_b1, _o6_b_c_d, _o6_b, _o6_b_c_d1, _o6_b1; | ||
o1 === null || o1 === void 0 ? void 0 : delete o1.b; | ||
delete (o1 === null || o1 === void 0 ? void 0 : o1.b); | ||
o2 === null || o2 === void 0 ? void 0 : delete o2.b.c; | ||
o2 === null || o2 === void 0 ? void 0 : delete o2.b.c; | ||
(_o3_b = o3.b) === null || _o3_b === void 0 ? void 0 : delete _o3_b.c; | ||
delete ((_o3_b1 = o3.b) === null || _o3_b1 === void 0 ? void 0 : _o3_b1.c); | ||
(_ref = (_o4_b = o4.b) === null || _o4_b === void 0 ? void 0 : _o4_b.c.d) === null || _ref === void 0 ? void 0 : delete _ref.e; | ||
(_ref1 = (_o4_b1 = o4.b) === null || _o4_b1 === void 0 ? void 0 : _o4_b1.c.d) === null || _ref1 === void 0 ? void 0 : delete _ref1.e; | ||
delete ((_ref2 = (_o4_b2 = o4.b) === null || _o4_b2 === void 0 ? void 0 : _o4_b2.c.d) === null || _ref2 === void 0 ? void 0 : _ref2.e); | ||
(_ref3 = (_o5_b = o5.b) === null || _o5_b === void 0 ? void 0 : _o5_b.call(o5).c.d) === null || _ref3 === void 0 ? void 0 : delete _ref3.e; | ||
delete ((_ref4 = (_o5_b1 = o5.b) === null || _o5_b1 === void 0 ? void 0 : _o5_b1.call(o5).c.d) === null || _ref4 === void 0 ? void 0 : _ref4.e); | ||
(_ref5 = (_o6_b = o6.b) === null || _o6_b === void 0 ? void 0 : _o6_b["c"].d) === null || _ref5 === void 0 ? void 0 : delete _ref5["e"]; | ||
delete ((_ref6 = (_o6_b1 = o6.b) === null || _o6_b1 === void 0 ? void 0 : _o6_b1["c"].d) === null || _ref6 === void 0 ? void 0 : _ref6["e"]); | ||
(_o4_b_c_d = (_o4_b = o4.b) === null || _o4_b === void 0 ? void 0 : _o4_b.c.d) === null || _o4_b_c_d === void 0 ? void 0 : delete _o4_b_c_d.e; | ||
(_o4_b_c_d1 = (_o4_b1 = o4.b) === null || _o4_b1 === void 0 ? void 0 : _o4_b1.c.d) === null || _o4_b_c_d1 === void 0 ? void 0 : delete _o4_b_c_d1.e; | ||
delete ((_o4_b_c_d2 = (_o4_b2 = o4.b) === null || _o4_b2 === void 0 ? void 0 : _o4_b2.c.d) === null || _o4_b_c_d2 === void 0 ? void 0 : _o4_b_c_d2.e); | ||
(_o5_b_c_d = (_o5_b = o5.b) === null || _o5_b === void 0 ? void 0 : _o5_b.call(o5).c.d) === null || _o5_b_c_d === void 0 ? void 0 : delete _o5_b_c_d.e; | ||
delete ((_o5_b_c_d1 = (_o5_b1 = o5.b) === null || _o5_b1 === void 0 ? void 0 : _o5_b1.call(o5).c.d) === null || _o5_b_c_d1 === void 0 ? void 0 : _o5_b_c_d1.e); | ||
(_o6_b_c_d = (_o6_b = o6.b) === null || _o6_b === void 0 ? void 0 : _o6_b["c"].d) === null || _o6_b_c_d === void 0 ? void 0 : delete _o6_b_c_d["e"]; | ||
delete ((_o6_b_c_d1 = (_o6_b1 = o6.b) === null || _o6_b1 === void 0 ? void 0 : _o6_b1["c"].d) === null || _o6_b_c_d1 === void 0 ? void 0 : _o6_b_c_d1["e"]); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 7 additions & 7 deletions
14
crates/swc/tests/tsc-references/elementAccessChain.1.normal.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
4 changes: 2 additions & 2 deletions
4
crates/swc/tests/tsc-references/elementAccessChain.2.minified.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
12 changes: 6 additions & 6 deletions
12
crates/swc/tests/tsc-references/logicalAssignment8(target=es2015).1.normal.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,13 +1,13 @@ | ||
//// [logicalAssignment8.ts] | ||
function foo1(results) { | ||
var _ref; | ||
(results || (results = (_ref = bar === null || bar === void 0 ? void 0 : bar.value) !== null && _ref !== void 0 ? _ref : [])).push(100); | ||
var _bar_value; | ||
(results || (results = (_bar_value = bar === null || bar === void 0 ? void 0 : bar.value) !== null && _bar_value !== void 0 ? _bar_value : [])).push(100); | ||
} | ||
function foo2(results) { | ||
var _ref; | ||
(results !== null && results !== void 0 ? results : results = (_ref = bar === null || bar === void 0 ? void 0 : bar.value) !== null && _ref !== void 0 ? _ref : []).push(100); | ||
var _bar_value; | ||
(results !== null && results !== void 0 ? results : results = (_bar_value = bar === null || bar === void 0 ? void 0 : bar.value) !== null && _bar_value !== void 0 ? _bar_value : []).push(100); | ||
} | ||
function foo3(results) { | ||
var _ref; | ||
(results && (results = (_ref = bar === null || bar === void 0 ? void 0 : bar.value) !== null && _ref !== void 0 ? _ref : [])).push(100); | ||
var _bar_value; | ||
(results && (results = (_bar_value = bar === null || bar === void 0 ? void 0 : bar.value) !== null && _bar_value !== void 0 ? _bar_value : [])).push(100); | ||
} |
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: 2 additions & 2 deletions
4
crates/swc/tests/tsc-references/nullishCoalescingOperator12.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,6 +1,6 @@ | ||
//// [nullishCoalescingOperator12.ts] | ||
var _ref; | ||
var _obj_arr; | ||
const obj = { | ||
arr: [] | ||
}; | ||
for (const i of null !== (_ref = null == obj ? void 0 : obj.arr) && void 0 !== _ref ? _ref : []); | ||
for (const i of null !== (_obj_arr = null == obj ? void 0 : obj.arr) && void 0 !== _obj_arr ? _obj_arr : []); |
Oops, something went wrong.
f7072db
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
334805
ns/iter (± 18127
)336386
ns/iter (± 16008
)1.00
es/full/minify/libraries/antd
1780667832
ns/iter (± 17173485
)1829925137
ns/iter (± 19703431
)0.97
es/full/minify/libraries/d3
381082585
ns/iter (± 7200345
)394936502
ns/iter (± 14038189
)0.96
es/full/minify/libraries/echarts
1547630428
ns/iter (± 22586360
)1597043020
ns/iter (± 32949043
)0.97
es/full/minify/libraries/jquery
98626124
ns/iter (± 2971453
)112455796
ns/iter (± 3168567
)0.88
es/full/minify/libraries/lodash
116907486
ns/iter (± 3089676
)132469716
ns/iter (± 4546946
)0.88
es/full/minify/libraries/moment
58622385
ns/iter (± 2255961
)62608562
ns/iter (± 3260619
)0.94
es/full/minify/libraries/react
19450406
ns/iter (± 510833
)22530641
ns/iter (± 1009319
)0.86
es/full/minify/libraries/terser
289477464
ns/iter (± 7208734
)313290319
ns/iter (± 4965725
)0.92
es/full/minify/libraries/three
542243840
ns/iter (± 7665782
)565116172
ns/iter (± 15612929
)0.96
es/full/minify/libraries/typescript
3245973174
ns/iter (± 22954304
)3353129683
ns/iter (± 25602673
)0.97
es/full/minify/libraries/victory
789988605
ns/iter (± 10590936
)820400434
ns/iter (± 11924354
)0.96
es/full/minify/libraries/vue
148323945
ns/iter (± 3007185
)151618721
ns/iter (± 6198946
)0.98
es/full/codegen/es3
33414
ns/iter (± 1301
)33564
ns/iter (± 533
)1.00
es/full/codegen/es5
33367
ns/iter (± 804
)33552
ns/iter (± 322
)0.99
es/full/codegen/es2015
33589
ns/iter (± 1278
)33492
ns/iter (± 591
)1.00
es/full/codegen/es2016
33485
ns/iter (± 874
)33532
ns/iter (± 765
)1.00
es/full/codegen/es2017
33443
ns/iter (± 926
)33529
ns/iter (± 1367
)1.00
es/full/codegen/es2018
33490
ns/iter (± 1231
)33053
ns/iter (± 979
)1.01
es/full/codegen/es2019
33659
ns/iter (± 996
)33213
ns/iter (± 577
)1.01
es/full/codegen/es2020
33404
ns/iter (± 1846
)32598
ns/iter (± 1170
)1.02
es/full/all/es3
184563807
ns/iter (± 5806100
)189891800
ns/iter (± 5512388
)0.97
es/full/all/es5
174353068
ns/iter (± 5635998
)179208144
ns/iter (± 5100538
)0.97
es/full/all/es2015
139550268
ns/iter (± 2434944
)143821154
ns/iter (± 4045032
)0.97
es/full/all/es2016
138933989
ns/iter (± 3265699
)142141554
ns/iter (± 4979353
)0.98
es/full/all/es2017
137643683
ns/iter (± 2704993
)142283418
ns/iter (± 5250951
)0.97
es/full/all/es2018
136547949
ns/iter (± 3141469
)140380853
ns/iter (± 4125286
)0.97
es/full/all/es2019
136033205
ns/iter (± 2568960
)139195315
ns/iter (± 3421829
)0.98
es/full/all/es2020
130946022
ns/iter (± 2042192
)133959142
ns/iter (± 3532239
)0.98
es/full/parser
687876
ns/iter (± 29004
)721884
ns/iter (± 49747
)0.95
es/full/base/fixer
25829
ns/iter (± 857
)26238
ns/iter (± 1030
)0.98
es/full/base/resolver_and_hygiene
88804
ns/iter (± 3811
)91058
ns/iter (± 4382
)0.98
serialization of ast node
211
ns/iter (± 3
)217
ns/iter (± 2
)0.97
serialization of serde
218
ns/iter (± 5
)221
ns/iter (± 3
)0.99
This comment was automatically generated by workflow using github-action-benchmark.