-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(es/transforms/compat): Add loose mode to
parameters
(#2911)
swc_ecma_utils: - Make `WrapperState` implement `Clone`. swc_ecma_transforms_compat: - `paramters`: Fix handling of non-loose mode. (Closes #2800, Closes #2825)
- Loading branch information
Showing
147 changed files
with
1,988 additions
and
1,374 deletions.
There are no files selected for viewing
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
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
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,5 +1,5 @@ | ||
export function example(param, param1, param2) { | ||
var a = param === void 0 ? 'click' : param, b = param1 === void 0 ? { | ||
} : param1, c = param2 === void 0 ? 1 : param2; | ||
export function example() { | ||
var a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'click', b = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { | ||
}, c = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1; | ||
console.log(a, b, 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
function foo(param, param1) { | ||
var arg1 = param === void 0 ? 1 : param, arg2 = param1 === void 0 ? 1 : param1; | ||
function foo() { | ||
var arg1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1, arg2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1; | ||
} |
4 changes: 2 additions & 2 deletions
4
...sync/es2017/asyncArrowFunction/asyncArrowFunction3_es2017/input.ts/es5.1.normal/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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// @target: es2017 | ||
// @noEmitHelpers: true | ||
function f(param) { | ||
var _await = param === void 0 ? _await : param; | ||
function f() { | ||
var _await = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _await; | ||
} |
4 changes: 2 additions & 2 deletions
4
...017/functionDeclarations/asyncFunctionDeclaration3_es2017/input.ts/es5.1.normal/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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// @target: es2017 | ||
// @noEmitHelpers: true | ||
function f(param) { | ||
var _await = param === void 0 ? _await : param; | ||
function f() { | ||
var _await = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _await; | ||
} |
4 changes: 2 additions & 2 deletions
4
...nces/async/es5/asyncArrowFunction/asyncArrowFunction3_es5/input.ts/es5.1.normal/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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// @target: ES5 | ||
// @lib: es5,es2015.promise | ||
// @noEmitHelpers: true | ||
function f(param) { | ||
var _await = param === void 0 ? _await : param; | ||
function f() { | ||
var _await = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _await; | ||
} |
4 changes: 2 additions & 2 deletions
4
...nc/es5/functionDeclarations/asyncFunctionDeclaration3_es5/input.ts/es5.1.normal/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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// @target: ES5 | ||
// @lib: es5,es2015.promise | ||
// @noEmitHelpers: true | ||
function f(param) { | ||
var _await = param === void 0 ? _await : param; | ||
function f() { | ||
var _await = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _await; | ||
} |
4 changes: 2 additions & 2 deletions
4
...nces/async/es6/asyncArrowFunction/asyncArrowFunction3_es6/input.ts/es5.1.normal/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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// @target: ES6 | ||
// @noEmitHelpers: true | ||
function f(param) { | ||
var _await = param === void 0 ? _await : param; | ||
function f() { | ||
var _await = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _await; | ||
} |
4 changes: 2 additions & 2 deletions
4
...nc/es6/functionDeclarations/asyncFunctionDeclaration3_es6/input.ts/es5.1.normal/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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// @target: ES6 | ||
// @noEmitHelpers: true | ||
function f(param) { | ||
var _await = param === void 0 ? _await : param; | ||
function f() { | ||
var _await = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _await; | ||
} |
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
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
15 changes: 9 additions & 6 deletions
15
...sExpressions/classWithStaticFieldInParameterInitializer/input.ts/es5.2.minified/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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
(function _class() { | ||
"use strict"; | ||
!function(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
}(this, _class); | ||
}).x = 1; | ||
var _class1; | ||
!function() { | ||
arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : (_class1 = function _class() { | ||
"use strict"; | ||
!function(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
}(this, _class); | ||
}).x = 1; | ||
}(); |
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
13 changes: 7 additions & 6 deletions
13
...uctorParameters/constructorDefaultValuesReferencingThis/input.ts/es5.2.minified/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 |
---|---|---|
@@ -1,13 +1,14 @@ | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
var C = function(param) { | ||
var C = function() { | ||
"use strict"; | ||
_classCallCheck(this, C); | ||
}, D = function(param) { | ||
arguments.length > 0 && void 0 !== arguments[0] && arguments[0], _classCallCheck(this, C); | ||
}, D = function() { | ||
"use strict"; | ||
_classCallCheck(this, D); | ||
}, E = function(param) { | ||
arguments.length > 0 && void 0 !== arguments[0] && arguments[0], _classCallCheck(this, D); | ||
}, E = function() { | ||
"use strict"; | ||
_classCallCheck(this, E), this.x = void 0 === param ? this : param; | ||
var x = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this; | ||
_classCallCheck(this, E), this.x = x; | ||
}; |
Oops, something went wrong.
1555ceb
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
base_tr_fixer
22939
ns/iter (± 304
)28703
ns/iter (± 5499
)0.80
base_tr_resolver_and_hygiene
127098
ns/iter (± 24481
)158637
ns/iter (± 28308
)0.80
codegen_es2015
52953
ns/iter (± 270
)54195
ns/iter (± 13636
)0.98
codegen_es2016
52595
ns/iter (± 355
)54724
ns/iter (± 7432
)0.96
codegen_es2017
52539
ns/iter (± 357
)56818
ns/iter (± 12442
)0.92
codegen_es2018
52605
ns/iter (± 365
)55151
ns/iter (± 7823
)0.95
codegen_es2019
52689
ns/iter (± 296
)56256
ns/iter (± 8793
)0.94
codegen_es2020
53009
ns/iter (± 325
)60150
ns/iter (± 10992
)0.88
codegen_es3
52778
ns/iter (± 2158
)57552
ns/iter (± 8938
)0.92
codegen_es5
53064
ns/iter (± 491
)54072
ns/iter (± 11182
)0.98
full_es2015
180917865
ns/iter (± 6461087
)183018082
ns/iter (± 21758076
)0.99
full_es2016
146462012
ns/iter (± 4981696
)144549215
ns/iter (± 12482237
)1.01
full_es2017
152456774
ns/iter (± 6526220
)150006073
ns/iter (± 21338366
)1.02
full_es2018
152017287
ns/iter (± 6457730
)149482604
ns/iter (± 20924274
)1.02
full_es2019
149436951
ns/iter (± 7227753
)145224749
ns/iter (± 11315376
)1.03
full_es2020
149656936
ns/iter (± 6836111
)149227626
ns/iter (± 21518910
)1.00
full_es3
207199749
ns/iter (± 14659026
)226531250
ns/iter (± 31075580
)0.91
full_es5
193925052
ns/iter (± 9649002
)190253138
ns/iter (± 18045581
)1.02
parser
687452
ns/iter (± 21513
)723487
ns/iter (± 214964
)0.95
ser_ast_node
152
ns/iter (± 5
)137
ns/iter (± 22
)1.11
ser_serde
150
ns/iter (± 2
)146
ns/iter (± 32
)1.03
emit_colors
16564264
ns/iter (± 21458740
)4555285
ns/iter (± 5894678
)3.64
emit_large
116016735
ns/iter (± 175888971
)65549155
ns/iter (± 88694077
)1.77
base_clone
2411345
ns/iter (± 38043
)2402710
ns/iter (± 478011
)1.00
fold_span
3910485
ns/iter (± 43405
)3961874
ns/iter (± 427560
)0.99
fold_span_panic
4094006
ns/iter (± 115009
)4126697
ns/iter (± 551332
)0.99
visit_mut_span
2902208
ns/iter (± 52619
)3061031
ns/iter (± 641860
)0.95
visit_mut_span_panic
2955559
ns/iter (± 42258
)2953359
ns/iter (± 452313
)1.00
ast_clone
17497
ns/iter (± 110
)21056
ns/iter (± 4898
)0.83
ast_clone_to_stable
51776
ns/iter (± 653
)67175
ns/iter (± 14003
)0.77
ast_clone_to_stable_then_to_unstable
94544
ns/iter (± 403
)116691
ns/iter (± 29552
)0.81
json_deserialize
1902402
ns/iter (± 7968
)2130988
ns/iter (± 393557
)0.89
json_serialize
92003
ns/iter (± 728
)87941
ns/iter (± 15446
)1.05
boxing_boxed
128
ns/iter (± 0
)118
ns/iter (± 34
)1.08
boxing_boxed_clone
67
ns/iter (± 0
)63
ns/iter (± 32
)1.06
boxing_unboxed
110
ns/iter (± 0
)104
ns/iter (± 17
)1.06
boxing_unboxed_clone
62
ns/iter (± 0
)61
ns/iter (± 17
)1.02
time_10
316
ns/iter (± 1
)303
ns/iter (± 81
)1.04
time_15
668
ns/iter (± 4
)610
ns/iter (± 144
)1.10
time_20
1390
ns/iter (± 12
)1108
ns/iter (± 223
)1.25
time_40
6588
ns/iter (± 43
)4413
ns/iter (± 934
)1.49
time_5
99
ns/iter (± 0
)99
ns/iter (± 17
)1
time_60
14792
ns/iter (± 31
)9458
ns/iter (± 1571
)1.56
This comment was automatically generated by workflow using github-action-benchmark.
1555ceb
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.
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2
.emit_colors
16564264
ns/iter (± 21458740
)4555285
ns/iter (± 5894678
)3.64
This comment was automatically generated by workflow using github-action-benchmark.
CC: @kdy1