-
-
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/parser): Fix infinite loop on jsx in js (#7191)
- Loading branch information
1 parent
4884345
commit 414e669
Showing
3 changed files
with
41 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const a = ( | ||
<section> | ||
<a href="/foo">foo</a> | ||
</section> | ||
); |
32 changes: 32 additions & 0 deletions
32
crates/swc_ecma_parser/tests/errors/jsx_in_js/input.js.swc-stderr
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,32 @@ | ||
|
||
x Unterminated regexp literal | ||
,-[$DIR/tests/errors/jsx_in_js/input.js:2:1] | ||
2 | <section> | ||
3 | <a href="/foo">foo</a> | ||
: ^^^ | ||
4 | </section> | ||
`---- | ||
|
||
x Expression expected | ||
,-[$DIR/tests/errors/jsx_in_js/input.js:1:1] | ||
1 | const a = ( | ||
2 | <section> | ||
: ^ | ||
3 | <a href="/foo">foo</a> | ||
`---- | ||
|
||
x Expression expected | ||
,-[$DIR/tests/errors/jsx_in_js/input.js:2:1] | ||
2 | <section> | ||
3 | <a href="/foo">foo</a> | ||
: ^ | ||
4 | </section> | ||
`---- | ||
|
||
x Expected a semicolon | ||
,-[$DIR/tests/errors/jsx_in_js/input.js:2:1] | ||
2 | <section> | ||
3 | <a href="/foo">foo</a> | ||
: ^^^^ | ||
4 | </section> | ||
`---- |
414e669
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
300625
ns/iter (± 14976
)317035
ns/iter (± 10262
)0.95
es/full/minify/libraries/antd
1580930538
ns/iter (± 17129437
)1698543792
ns/iter (± 32157292
)0.93
es/full/minify/libraries/d3
304139037
ns/iter (± 4297301
)307545506
ns/iter (± 5010156
)0.99
es/full/minify/libraries/echarts
1223826101
ns/iter (± 9721341
)1275224709
ns/iter (± 20989048
)0.96
es/full/minify/libraries/jquery
91980185
ns/iter (± 782199
)91291729
ns/iter (± 1655977
)1.01
es/full/minify/libraries/lodash
106944248
ns/iter (± 949846
)104635009
ns/iter (± 761647
)1.02
es/full/minify/libraries/moment
52740231
ns/iter (± 369503
)51635542
ns/iter (± 382175
)1.02
es/full/minify/libraries/react
19791360
ns/iter (± 306224
)19316357
ns/iter (± 275976
)1.02
es/full/minify/libraries/terser
251659541
ns/iter (± 1516725
)241615873
ns/iter (± 3396312
)1.04
es/full/minify/libraries/three
448598482
ns/iter (± 5145574
)437207996
ns/iter (± 6394612
)1.03
es/full/minify/libraries/typescript
2949009294
ns/iter (± 10134843
)3315511763
ns/iter (± 40535187
)0.89
es/full/minify/libraries/victory
665864167
ns/iter (± 10086221
)665833093
ns/iter (± 10337008
)1.00
es/full/minify/libraries/vue
130300681
ns/iter (± 1029586
)128594805
ns/iter (± 866011
)1.01
es/full/codegen/es3
28834
ns/iter (± 85
)28368
ns/iter (± 111
)1.02
es/full/codegen/es5
29030
ns/iter (± 75
)28556
ns/iter (± 37
)1.02
es/full/codegen/es2015
29037
ns/iter (± 29
)28457
ns/iter (± 89
)1.02
es/full/codegen/es2016
29058
ns/iter (± 63
)28260
ns/iter (± 158
)1.03
es/full/codegen/es2017
29033
ns/iter (± 49
)28496
ns/iter (± 68
)1.02
es/full/codegen/es2018
29008
ns/iter (± 54
)28240
ns/iter (± 150
)1.03
es/full/codegen/es2019
29014
ns/iter (± 33
)28113
ns/iter (± 171
)1.03
es/full/codegen/es2020
29043
ns/iter (± 46
)28205
ns/iter (± 219
)1.03
es/full/all/es3
182476556
ns/iter (± 4289114
)182040064
ns/iter (± 2974136
)1.00
es/full/all/es5
173157496
ns/iter (± 3318575
)174799384
ns/iter (± 3348928
)0.99
es/full/all/es2015
135117340
ns/iter (± 1577216
)135156103
ns/iter (± 2932066
)1.00
es/full/all/es2016
132562302
ns/iter (± 1732328
)132090111
ns/iter (± 2400776
)1.00
es/full/all/es2017
130375242
ns/iter (± 2398616
)130577286
ns/iter (± 1228920
)1.00
es/full/all/es2018
127425319
ns/iter (± 1613717
)128071928
ns/iter (± 3549084
)0.99
es/full/all/es2019
124646877
ns/iter (± 1679382
)124351592
ns/iter (± 929221
)1.00
es/full/all/es2020
118738359
ns/iter (± 2096454
)117400340
ns/iter (± 757229
)1.01
es/full/parser
519758
ns/iter (± 7816
)513829
ns/iter (± 12922
)1.01
es/full/base/fixer
22675
ns/iter (± 39
)23681
ns/iter (± 137
)0.96
es/full/base/resolver_and_hygiene
84271
ns/iter (± 72
)83675
ns/iter (± 823
)1.01
serialization of serde
127
ns/iter (± 1
)126
ns/iter (± 0
)1.01
css/minify/libraries/bootstrap
27749998
ns/iter (± 162033
)26743558
ns/iter (± 190739
)1.04
css/visitor/compare/clone
2129664
ns/iter (± 7078
)2125420
ns/iter (± 4875
)1.00
css/visitor/compare/visit_mut_span
2329491
ns/iter (± 8967
)2278881
ns/iter (± 14065
)1.02
css/visitor/compare/visit_mut_span_panic
2378325
ns/iter (± 3774
)2358754
ns/iter (± 4714
)1.01
css/visitor/compare/fold_span
3118643
ns/iter (± 4194
)3083554
ns/iter (± 16267
)1.01
css/visitor/compare/fold_span_panic
3256208
ns/iter (± 16897
)3261700
ns/iter (± 10358
)1.00
css/lexer/bootstrap_5_1_3
5148990
ns/iter (± 22131
)5098060
ns/iter (± 25057
)1.01
css/lexer/foundation_6_7_4
4355139
ns/iter (± 1454
)4292790
ns/iter (± 23214
)1.01
css/lexer/tailwind_3_1_1
822645
ns/iter (± 318
)823851
ns/iter (± 1159
)1.00
css/parser/bootstrap_5_1_3
21271262
ns/iter (± 167625
)20617686
ns/iter (± 170431
)1.03
css/parser/foundation_6_7_4
16879637
ns/iter (± 69541
)16440526
ns/iter (± 54737
)1.03
css/parser/tailwind_3_1_1
3239189
ns/iter (± 2863
)3215052
ns/iter (± 16673
)1.01
es/codegen/colors
328226
ns/iter (± 185632
)320527
ns/iter (± 181462
)1.02
es/codegen/large
1253442
ns/iter (± 642787
)1228127
ns/iter (± 631088
)1.02
es/codegen/with-parser/colors
47274
ns/iter (± 266
)46833
ns/iter (± 758
)1.01
es/codegen/with-parser/large
507772
ns/iter (± 2055
)502265
ns/iter (± 3149
)1.01
es/minify/libraries/antd
1381730378
ns/iter (± 9546087
)1504764192
ns/iter (± 29044016
)0.92
es/minify/libraries/d3
260083019
ns/iter (± 2583089
)248647791
ns/iter (± 4199240
)1.05
es/minify/libraries/echarts
1061980759
ns/iter (± 5992115
)1078727190
ns/iter (± 9024794
)0.98
es/minify/libraries/jquery
79617566
ns/iter (± 597908
)78366581
ns/iter (± 1113673
)1.02
es/minify/libraries/lodash
95157433
ns/iter (± 1106375
)93648756
ns/iter (± 1022341
)1.02
es/minify/libraries/moment
46444108
ns/iter (± 828504
)45783687
ns/iter (± 502885
)1.01
es/minify/libraries/react
17264981
ns/iter (± 196256
)16825234
ns/iter (± 82179
)1.03
es/minify/libraries/terser
218294422
ns/iter (± 6631649
)204180504
ns/iter (± 2101476
)1.07
es/minify/libraries/three
374279301
ns/iter (± 6829552
)375455647
ns/iter (± 9434251
)1.00
es/minify/libraries/typescript
2509708099
ns/iter (± 13595394
)2816548672
ns/iter (± 23128409
)0.89
es/minify/libraries/victory
587189916
ns/iter (± 9149455
)565465516
ns/iter (± 15025404
)1.04
es/minify/libraries/vue
118023263
ns/iter (± 1164668
)113878452
ns/iter (± 666734
)1.04
es/visitor/compare/clone
2317057
ns/iter (± 8615
)2295122
ns/iter (± 8106
)1.01
es/visitor/compare/visit_mut_span
2693631
ns/iter (± 4932
)2646212
ns/iter (± 10706
)1.02
es/visitor/compare/visit_mut_span_panic
2755619
ns/iter (± 4729
)2696219
ns/iter (± 14251
)1.02
es/visitor/compare/fold_span
3806826
ns/iter (± 9967
)3756038
ns/iter (± 24749
)1.01
es/visitor/compare/fold_span_panic
3935015
ns/iter (± 14954
)3898212
ns/iter (± 25037
)1.01
es/lexer/colors
13217
ns/iter (± 15
)12931
ns/iter (± 86
)1.02
es/lexer/angular
6444899
ns/iter (± 3126
)6394735
ns/iter (± 45567
)1.01
es/lexer/backbone
773293
ns/iter (± 298
)764621
ns/iter (± 4721
)1.01
es/lexer/jquery
4370091
ns/iter (± 2392
)4310435
ns/iter (± 34527
)1.01
es/lexer/jquery mobile
6825064
ns/iter (± 7069
)6707527
ns/iter (± 64580
)1.02
es/lexer/mootools
3442896
ns/iter (± 1565
)3441910
ns/iter (± 11289
)1.00
es/lexer/underscore
639085
ns/iter (± 426
)634200
ns/iter (± 3806
)1.01
es/lexer/three
20693133
ns/iter (± 22548
)20484672
ns/iter (± 97566
)1.01
es/lexer/yui
3859539
ns/iter (± 2114
)3846027
ns/iter (± 16970
)1.00
es/parser/colors
29073
ns/iter (± 201
)28335
ns/iter (± 236
)1.03
es/parser/angular
15062046
ns/iter (± 140662
)14705215
ns/iter (± 156563
)1.02
es/parser/backbone
2167681
ns/iter (± 8750
)2123300
ns/iter (± 20521
)1.02
es/parser/jquery
11806085
ns/iter (± 120985
)11554338
ns/iter (± 110826
)1.02
es/parser/jquery mobile
18854934
ns/iter (± 201224
)17884937
ns/iter (± 122906
)1.05
es/parser/mootools
8979375
ns/iter (± 32243
)8751185
ns/iter (± 41808
)1.03
es/parser/underscore
1830590
ns/iter (± 12267
)1798703
ns/iter (± 19220
)1.02
es/parser/three
54716233
ns/iter (± 385118
)52841678
ns/iter (± 1136259
)1.04
es/parser/yui
9078148
ns/iter (± 62241
)8919548
ns/iter (± 67888
)1.02
es/preset-env/usage/builtin_type
142913
ns/iter (± 32850
)142291
ns/iter (± 32797
)1.00
es/preset-env/usage/property
20942
ns/iter (± 45
)20997
ns/iter (± 82
)1.00
es/resolver/typescript
113764652
ns/iter (± 2663673
)126209432
ns/iter (± 1780861
)0.90
es/fixer/typescript
79944661
ns/iter (± 2525837
)94129574
ns/iter (± 2148587
)0.85
es/hygiene/typescript
168635697
ns/iter (± 1949563
)200045013
ns/iter (± 2899682
)0.84
es/resolver_with_hygiene/typescript
306261927
ns/iter (± 3627574
)347620806
ns/iter (± 4531391
)0.88
es/visitor/base-perf/module_clone
81596
ns/iter (± 281
)80318
ns/iter (± 428
)1.02
es/visitor/base-perf/fold_empty
90678
ns/iter (± 325
)89877
ns/iter (± 567
)1.01
es/visitor/base-perf/fold_noop_impl_all
91320
ns/iter (± 423
)90086
ns/iter (± 553
)1.01
es/visitor/base-perf/fold_noop_impl_vec
91242
ns/iter (± 331
)90192
ns/iter (± 705
)1.01
es/visitor/base-perf/boxing_boxed_clone
58
ns/iter (± 0
)55
ns/iter (± 0
)1.05
es/visitor/base-perf/boxing_unboxed_clone
41
ns/iter (± 0
)41
ns/iter (± 0
)1
es/visitor/base-perf/boxing_boxed
102
ns/iter (± 0
)103
ns/iter (± 0
)0.99
es/visitor/base-perf/boxing_unboxed
78
ns/iter (± 0
)77
ns/iter (± 0
)1.01
es/visitor/base-perf/visit_contains_this
3465
ns/iter (± 74
)3610
ns/iter (± 74
)0.96
es/base/parallel/resolver/typescript
6077177972
ns/iter (± 360699162
)6564634539
ns/iter (± 590313023
)0.93
es/base/parallel/hygiene/typescript
2012975725
ns/iter (± 20256300
)2493008979
ns/iter (± 17972183
)0.81
misc/visitors/time-complexity/time 5
105
ns/iter (± 0
)103
ns/iter (± 0
)1.02
misc/visitors/time-complexity/time 10
330
ns/iter (± 0
)321
ns/iter (± 0
)1.03
misc/visitors/time-complexity/time 15
662
ns/iter (± 0
)651
ns/iter (± 4
)1.02
misc/visitors/time-complexity/time 20
1221
ns/iter (± 17
)1209
ns/iter (± 6
)1.01
misc/visitors/time-complexity/time 40
5996
ns/iter (± 5
)6114
ns/iter (± 27
)0.98
misc/visitors/time-complexity/time 60
13313
ns/iter (± 6
)15448
ns/iter (± 114
)0.86
es/full-target/es2016
253694
ns/iter (± 372
)249394
ns/iter (± 1713
)1.02
es/full-target/es2017
246418
ns/iter (± 334
)243742
ns/iter (± 1039
)1.01
es/full-target/es2018
235910
ns/iter (± 501
)232330
ns/iter (± 861
)1.02
es2020_nullish_coalescing
93017
ns/iter (± 256
)91683
ns/iter (± 512
)1.01
es2020_optional_chaining
124323
ns/iter (± 174
)122181
ns/iter (± 309
)1.02
es2022_class_properties
149080
ns/iter (± 214
)146605
ns/iter (± 648
)1.02
es2018_object_rest_spread
96419
ns/iter (± 107
)94939
ns/iter (± 534
)1.02
es2019_optional_catch_binding
85345
ns/iter (± 246
)84207
ns/iter (± 493
)1.01
es2017_async_to_generator
86069
ns/iter (± 183
)84712
ns/iter (± 436
)1.02
es2016_exponentiation
90094
ns/iter (± 170
)87524
ns/iter (± 625
)1.03
es2015_arrow
93654
ns/iter (± 281
)90211
ns/iter (± 475
)1.04
es2015_block_scoped_fn
92450
ns/iter (± 207
)89415
ns/iter (± 344
)1.03
es2015_block_scoping
169866
ns/iter (± 319
)164447
ns/iter (± 882
)1.03
This comment was automatically generated by workflow using github-action-benchmark.