-
-
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/decorators): Fix bugs of
2022-03
implementation (#9145)
**Description:** I extracted some changes from #8970
- Loading branch information
Showing
32 changed files
with
489 additions
and
360 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
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 was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
...l/tests/decorator-evanw-split/Class-decorators-Binding-initialization-class-expression.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,39 @@ | ||
(() => { | ||
let old; | ||
let block; | ||
class Bar { | ||
} | ||
const dec = (cls, ctx) => { | ||
old = cls; | ||
return Bar; | ||
}; | ||
const Foo = | ||
@dec | ||
class Foo { | ||
static { block = Foo; } | ||
method() { return Foo; } | ||
static method() { return Foo; } | ||
field = Foo; | ||
static field = Foo; | ||
get getter() { return Foo; } | ||
static get getter() { return Foo; } | ||
set setter(x) { x.foo = Foo; } | ||
static set setter(x) { x.foo = Foo; } | ||
accessor accessor = Foo; | ||
static accessor accessor = Foo; | ||
}; | ||
const foo = new old; | ||
let obj; | ||
assertEq(() => Foo !== old, true); | ||
assertEq(() => Foo, Bar); | ||
assertEq(() => block, Bar); | ||
assertEq(() => Foo.field, Bar); | ||
assertEq(() => foo.field, Bar); | ||
assertEq(() => old.getter, Bar); | ||
assertEq(() => foo.getter, Bar); | ||
assertEq(() => (obj = { foo: null }, old.setter = obj, obj.foo), Bar); | ||
assertEq(() => (obj = { foo: null }, foo.setter = obj, obj.foo), Bar); | ||
// The specification for accessors is potentially wrong at the moment: https://github.com/tc39/proposal-decorators/issues/529 | ||
// assertEq(() => old.accessor, Bar) | ||
// assertEq(() => foo.accessor, Bar) | ||
})(); |
38 changes: 38 additions & 0 deletions
38
...al/tests/decorator-evanw-split/Class-decorators-Binding-initialization-class-statement.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,38 @@ | ||
(() => { | ||
let old; | ||
let block; | ||
class Bar { | ||
} | ||
const dec = (cls, ctx) => { | ||
old = cls; | ||
return Bar; | ||
}; | ||
@dec | ||
class Foo { | ||
static { block = Foo; } | ||
method() { return Foo; } | ||
static method() { return Foo; } | ||
field = Foo; | ||
static field = Foo; | ||
get getter() { return Foo; } | ||
static get getter() { return Foo; } | ||
set setter(x) { x.foo = Foo; } | ||
static set setter(x) { x.foo = Foo; } | ||
accessor accessor = Foo; | ||
static accessor accessor = Foo; | ||
} | ||
const foo = new old; | ||
let obj; | ||
assertEq(() => Foo !== old, true); | ||
assertEq(() => Foo, Bar); | ||
assertEq(() => block, Bar); | ||
assertEq(() => Foo.field, Bar); | ||
assertEq(() => foo.field, Bar); | ||
assertEq(() => old.getter, Bar); | ||
assertEq(() => foo.getter, Bar); | ||
assertEq(() => (obj = { foo: null }, old.setter = obj, obj.foo), Bar); | ||
assertEq(() => (obj = { foo: null }, foo.setter = obj, obj.foo), Bar); | ||
// The specification for accessors is potentially wrong at the moment: https://github.com/tc39/proposal-decorators/issues/529 | ||
// assertEq(() => old.accessor, Bar) | ||
// assertEq(() => foo.accessor, Bar) | ||
})(); |
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
Oops, something went wrong.
8a3ae44
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
275104
ns/iter (± 12640
)274048
ns/iter (± 2222
)1.00
es/full/minify/libraries/antd
1665521153
ns/iter (± 29656344
)1695564822
ns/iter (± 43062858
)0.98
es/full/minify/libraries/d3
338344728
ns/iter (± 810671
)338251959
ns/iter (± 1372251
)1.00
es/full/minify/libraries/echarts
1400422668
ns/iter (± 12728175
)1427217495
ns/iter (± 14874268
)0.98
es/full/minify/libraries/jquery
102830680
ns/iter (± 167229
)102396840
ns/iter (± 308663
)1.00
es/full/minify/libraries/lodash
113656974
ns/iter (± 213346
)112668806
ns/iter (± 355384
)1.01
es/full/minify/libraries/moment
59464580
ns/iter (± 71621
)59554359
ns/iter (± 151920
)1.00
es/full/minify/libraries/react
18413288
ns/iter (± 31153
)18508415
ns/iter (± 92394
)0.99
es/full/minify/libraries/terser
273900410
ns/iter (± 703685
)280054199
ns/iter (± 4005184
)0.98
es/full/minify/libraries/three
462502493
ns/iter (± 2343483
)500566661
ns/iter (± 7436001
)0.92
es/full/minify/libraries/typescript
3130810850
ns/iter (± 24505929
)3287195497
ns/iter (± 43476806
)0.95
es/full/minify/libraries/victory
706110545
ns/iter (± 3407934
)848389974
ns/iter (± 27201697
)0.83
es/full/minify/libraries/vue
145623520
ns/iter (± 214429
)147448330
ns/iter (± 1185001
)0.99
es/full/codegen/es3
58400
ns/iter (± 120
)59348
ns/iter (± 346
)0.98
es/full/codegen/es5
58481
ns/iter (± 219
)59727
ns/iter (± 438
)0.98
es/full/codegen/es2015
58502
ns/iter (± 142
)59537
ns/iter (± 84
)0.98
es/full/codegen/es2016
58755
ns/iter (± 144
)59131
ns/iter (± 190
)0.99
es/full/codegen/es2017
58584
ns/iter (± 129
)59344
ns/iter (± 255
)0.99
es/full/codegen/es2018
58652
ns/iter (± 214
)58975
ns/iter (± 112
)0.99
es/full/codegen/es2019
58530
ns/iter (± 124
)59036
ns/iter (± 110
)0.99
es/full/codegen/es2020
59096
ns/iter (± 83
)59019
ns/iter (± 181
)1.00
es/full/all/es3
160617920
ns/iter (± 630118
)162000009
ns/iter (± 623583
)0.99
es/full/all/es5
155274739
ns/iter (± 603144
)156348179
ns/iter (± 1108289
)0.99
es/full/all/es2015
115234450
ns/iter (± 853597
)115448792
ns/iter (± 904062
)1.00
es/full/all/es2016
114097912
ns/iter (± 484003
)113968466
ns/iter (± 768481
)1.00
es/full/all/es2017
113686841
ns/iter (± 464711
)113513408
ns/iter (± 617416
)1.00
es/full/all/es2018
111416090
ns/iter (± 351732
)111808085
ns/iter (± 677179
)1.00
es/full/all/es2019
110678576
ns/iter (± 451217
)111009208
ns/iter (± 575939
)1.00
es/full/all/es2020
106812132
ns/iter (± 318200
)106938012
ns/iter (± 835655
)1.00
es/full/parser
459166
ns/iter (± 2566
)463013
ns/iter (± 2555
)0.99
es/full/base/fixer
15243
ns/iter (± 118
)16571
ns/iter (± 53
)0.92
es/full/base/resolver_and_hygiene
80051
ns/iter (± 228
)81205
ns/iter (± 332
)0.99
serialization of serde
270
ns/iter (± 7
)268
ns/iter (± 8
)1.01
css/minify/libraries/bootstrap
21724176
ns/iter (± 22306
)21852382
ns/iter (± 52767
)0.99
css/visitor/compare/clone
1376564
ns/iter (± 16215
)1370006
ns/iter (± 28720
)1.00
css/visitor/compare/visit_mut_span
1491512
ns/iter (± 6166
)1492342
ns/iter (± 10608
)1.00
css/visitor/compare/visit_mut_span_panic
1508773
ns/iter (± 27227
)1514365
ns/iter (± 38888
)1.00
css/visitor/compare/fold_span
2015850
ns/iter (± 17160
)2012359
ns/iter (± 13215
)1.00
css/visitor/compare/fold_span_panic
2155141
ns/iter (± 32705
)2137985
ns/iter (± 8115
)1.01
css/lexer/bootstrap_5_1_3
3494528
ns/iter (± 27412
)3495403
ns/iter (± 12766
)1.00
css/lexer/foundation_6_7_4
2816034
ns/iter (± 6588
)2820485
ns/iter (± 2042
)1.00
css/lexer/tailwind_3_1_1
539221
ns/iter (± 12267
)541704
ns/iter (± 453
)1.00
css/parser/bootstrap_5_1_3
16776848
ns/iter (± 114477
)16390690
ns/iter (± 75830
)1.02
css/parser/foundation_6_7_4
13418304
ns/iter (± 70200
)13066224
ns/iter (± 51006
)1.03
css/parser/tailwind_3_1_1
2550123
ns/iter (± 3480
)2595918
ns/iter (± 6334
)0.98
es/codegen/colors
719769
ns/iter (± 396957
)751181
ns/iter (± 397426
)0.96
es/codegen/large
2989910
ns/iter (± 1611763
)3104250
ns/iter (± 1603922
)0.96
es/codegen/with-parser/colors
40597
ns/iter (± 1387
)40273
ns/iter (± 275
)1.01
es/codegen/with-parser/large
453283
ns/iter (± 9197
)454966
ns/iter (± 2411
)1.00
es/minify/libraries/antd
1475266131
ns/iter (± 29014351
)1506570317
ns/iter (± 64616813
)0.98
es/minify/libraries/d3
308412803
ns/iter (± 19790212
)280033637
ns/iter (± 2080207
)1.10
es/minify/libraries/echarts
1309257430
ns/iter (± 67850496
)1134426473
ns/iter (± 9853246
)1.15
es/minify/libraries/jquery
83428740
ns/iter (± 299840
)82544266
ns/iter (± 561856
)1.01
es/minify/libraries/lodash
104260551
ns/iter (± 379749
)104520766
ns/iter (± 662042
)1.00
es/minify/libraries/moment
48422493
ns/iter (± 87253
)48301710
ns/iter (± 129726
)1.00
es/minify/libraries/react
16340711
ns/iter (± 23694
)16269318
ns/iter (± 15714
)1.00
es/minify/libraries/terser
221283380
ns/iter (± 2774302
)216415118
ns/iter (± 1016348
)1.02
es/minify/libraries/three
377713372
ns/iter (± 7851115
)365704664
ns/iter (± 12829052
)1.03
es/minify/libraries/typescript
2797941299
ns/iter (± 25104984
)2726964196
ns/iter (± 14042092
)1.03
es/minify/libraries/victory
641582833
ns/iter (± 22276939
)563844360
ns/iter (± 5505773
)1.14
es/minify/libraries/vue
122821887
ns/iter (± 367424
)121634496
ns/iter (± 288874
)1.01
es/visitor/compare/clone
1712491
ns/iter (± 6740
)1726175
ns/iter (± 45558
)0.99
es/visitor/compare/visit_mut_span
2058216
ns/iter (± 8742
)2071947
ns/iter (± 9635
)0.99
es/visitor/compare/visit_mut_span_panic
2082179
ns/iter (± 47107
)2066842
ns/iter (± 28863
)1.01
es/visitor/compare/fold_span
2781853
ns/iter (± 11245
)2790543
ns/iter (± 9084
)1.00
es/visitor/compare/fold_span_panic
2836900
ns/iter (± 7937
)2813270
ns/iter (± 35620
)1.01
es/lexer/colors
9693
ns/iter (± 67
)9745
ns/iter (± 22
)0.99
es/lexer/angular
5024759
ns/iter (± 23040
)5082442
ns/iter (± 4202
)0.99
es/lexer/backbone
621418
ns/iter (± 981
)634768
ns/iter (± 2907
)0.98
es/lexer/jquery
3673385
ns/iter (± 6886
)3535031
ns/iter (± 3280
)1.04
es/lexer/jquery mobile
5245335
ns/iter (± 21104
)5289261
ns/iter (± 14665
)0.99
es/lexer/mootools
2768390
ns/iter (± 29065
)2804875
ns/iter (± 16049
)0.99
es/lexer/underscore
516594
ns/iter (± 2799
)518835
ns/iter (± 1489
)1.00
es/lexer/three
15841594
ns/iter (± 155704
)16051308
ns/iter (± 48689
)0.99
es/lexer/yui
2917211
ns/iter (± 5718
)2930361
ns/iter (± 25058
)1.00
es/lexer/cal-com
13137311
ns/iter (± 174559
)13273610
ns/iter (± 105495
)0.99
es/lexer/typescript
91260247
ns/iter (± 520538
)91338834
ns/iter (± 1048988
)1.00
es/parser/colors
23900
ns/iter (± 151
)23748
ns/iter (± 93
)1.01
es/parser/angular
12640039
ns/iter (± 75317
)12575286
ns/iter (± 72291
)1.01
es/parser/backbone
1821723
ns/iter (± 6299
)1827980
ns/iter (± 5369
)1.00
es/parser/jquery
10027751
ns/iter (± 87455
)10078458
ns/iter (± 63148
)0.99
es/parser/jquery mobile
15222741
ns/iter (± 110535
)15254876
ns/iter (± 132258
)1.00
es/parser/mootools
7777221
ns/iter (± 17964
)7825589
ns/iter (± 22352
)0.99
es/parser/underscore
1581962
ns/iter (± 4793
)1589804
ns/iter (± 5456
)1.00
es/parser/three
45307678
ns/iter (± 311858
)44457714
ns/iter (± 504088
)1.02
es/parser/yui
7473482
ns/iter (± 32817
)7467198
ns/iter (± 35468
)1.00
es/parser/cal-com
42758465
ns/iter (± 595797
)41156599
ns/iter (± 728390
)1.04
es/parser/typescript
270867110
ns/iter (± 1213605
)271669758
ns/iter (± 1451951
)1.00
es/preset-env/usage/builtin_type
137646
ns/iter (± 33938
)136446
ns/iter (± 34611
)1.01
es/preset-env/usage/property
16715
ns/iter (± 92
)16400
ns/iter (± 56
)1.02
es/resolver/typescript
99393894
ns/iter (± 1579483
)99383960
ns/iter (± 1753856
)1.00
es/fixer/typescript
79644669
ns/iter (± 4535999
)80600192
ns/iter (± 3461926
)0.99
es/hygiene/typescript
178774317
ns/iter (± 2871772
)187322364
ns/iter (± 4240872
)0.95
es/resolver_with_hygiene/typescript
303785732
ns/iter (± 6252098
)309636056
ns/iter (± 5850904
)0.98
es/visitor/base-perf/module_clone
56569
ns/iter (± 446
)55740
ns/iter (± 460
)1.01
es/visitor/base-perf/fold_empty
60270
ns/iter (± 866
)59330
ns/iter (± 563
)1.02
es/visitor/base-perf/fold_noop_impl_all
60389
ns/iter (± 616
)59170
ns/iter (± 466
)1.02
es/visitor/base-perf/fold_noop_impl_vec
60538
ns/iter (± 1475
)59670
ns/iter (± 709
)1.01
es/visitor/base-perf/boxing_boxed_clone
59
ns/iter (± 0
)59
ns/iter (± 0
)1
es/visitor/base-perf/boxing_unboxed_clone
47
ns/iter (± 0
)47
ns/iter (± 2
)1
es/visitor/base-perf/boxing_boxed
105
ns/iter (± 1
)106
ns/iter (± 0
)0.99
es/visitor/base-perf/boxing_unboxed
80
ns/iter (± 0
)79
ns/iter (± 0
)1.01
es/visitor/base-perf/visit_contains_this
2576
ns/iter (± 25
)2572
ns/iter (± 12
)1.00
es/base/parallel/resolver/typescript
2441844367
ns/iter (± 50486408
)2380133784
ns/iter (± 113477499
)1.03
es/base/parallel/hygiene/typescript
3154111650
ns/iter (± 54744328
)3213274802
ns/iter (± 67879057
)0.98
babelify-only
489834
ns/iter (± 11137
)490130
ns/iter (± 4591
)1.00
parse_and_babelify_angular
43578335
ns/iter (± 2551126
)40183701
ns/iter (± 491821
)1.08
parse_and_babelify_backbone
4382326
ns/iter (± 144889
)4558441
ns/iter (± 187783
)0.96
parse_and_babelify_jquery
28239315
ns/iter (± 170572
)31788859
ns/iter (± 499855
)0.89
parse_and_babelify_jquery_mobile
48600198
ns/iter (± 541787
)54354191
ns/iter (± 959141
)0.89
parse_and_babelify_mootools
25558410
ns/iter (± 600861
)29211635
ns/iter (± 548622
)0.87
parse_and_babelify_underscore
3692445
ns/iter (± 23064
)3752039
ns/iter (± 28073
)0.98
parse_and_babelify_yui
24075597
ns/iter (± 571870
)26767573
ns/iter (± 312629
)0.90
html/minify/document/css_spec
45927114
ns/iter (± 92281
)45176997
ns/iter (± 83988
)1.02
html/minify/document/github
18433453
ns/iter (± 947791
)18150050
ns/iter (± 109889
)1.02
html/minify/document/stackoverflow
16732582
ns/iter (± 896529
)16488364
ns/iter (± 348188
)1.01
html/minify/document_fragment/css_spec
44837014
ns/iter (± 105949
)43571678
ns/iter (± 136325
)1.03
html/minify/document_fragment/github
18092733
ns/iter (± 20061
)17731588
ns/iter (± 25099
)1.02
html/minify/document_fragment/stackoverflow
16413760
ns/iter (± 22170
)16155536
ns/iter (± 12278
)1.02
html/document/visitor/compare/clone
165941
ns/iter (± 3029
)161736
ns/iter (± 977
)1.03
html/document/visitor/compare/visit_mut_span
182482
ns/iter (± 818
)180865
ns/iter (± 1597
)1.01
html/document/visitor/compare/visit_mut_span_panic
190657
ns/iter (± 4258
)186157
ns/iter (± 7078
)1.02
html/document/visitor/compare/fold_span
232507
ns/iter (± 757
)231601
ns/iter (± 1969
)1.00
html/document/visitor/compare/fold_span_panic
283659
ns/iter (± 2922
)279870
ns/iter (± 799
)1.01
html/document_fragment/visitor/compare/clone
166287
ns/iter (± 1029
)165609
ns/iter (± 930
)1.00
html/document_fragment/visitor/compare/visit_mut_span
181698
ns/iter (± 877
)178842
ns/iter (± 1142
)1.02
html/document_fragment/visitor/compare/visit_mut_span_panic
188802
ns/iter (± 1490
)185962
ns/iter (± 1226
)1.02
html/document_fragment/visitor/compare/fold_span
233997
ns/iter (± 1602
)230181
ns/iter (± 978
)1.02
html/document_fragment/visitor/compare/fold_span_panic
283912
ns/iter (± 1791
)278692
ns/iter (± 1578
)1.02
html/lexer/css_2021_spec
12821453
ns/iter (± 300793
)12891237
ns/iter (± 12905
)0.99
html/lexer/github_com_17_05_2022
4934977
ns/iter (± 13059
)4954055
ns/iter (± 7199
)1.00
html/lexer/stackoverflow_com_17_05_2022
4664479
ns/iter (± 270882
)4679667
ns/iter (± 25926
)1.00
html/parser/parser_document/css_2021_spec
25788274
ns/iter (± 160041
)25582698
ns/iter (± 184010
)1.01
html/parser/parser_document/github_com_17_05_2022
8522270
ns/iter (± 28093
)8578570
ns/iter (± 73553
)0.99
html/parser/parser_document/stackoverflow_com_17_05_2022
7458872
ns/iter (± 9798
)7397852
ns/iter (± 13320
)1.01
html/parser/parser_document_fragment/css_2021_spec
25463161
ns/iter (± 153706
)25038692
ns/iter (± 186485
)1.02
html/parser/parser_document_fragment/github_com_17_05_2022
8492372
ns/iter (± 24856
)8582789
ns/iter (± 37470
)0.99
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022
7452926
ns/iter (± 21024
)7346312
ns/iter (± 10543
)1.01
This comment was automatically generated by workflow using github-action-benchmark.