-
-
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.
fix(es/parser): Check for line break after async (#4940)
- Loading branch information
1 parent
bfede71
commit 381d273
Showing
15 changed files
with
116 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": false | ||
}, | ||
"target": "es2022", | ||
"loose": false, | ||
"minify": { | ||
"compress": false, | ||
"mangle": false | ||
} | ||
}, | ||
"module": { | ||
"type": "es6" | ||
}, | ||
"minify": false | ||
} |
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,4 @@ | ||
const async = '1'; | ||
let script = document.createElement("script") | ||
script.async = async | ||
script.onload = resolve(key) |
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,4 @@ | ||
const async = '1'; | ||
let script = document.createElement("script"); | ||
script.async = async; | ||
script.onload = resolve(key); |
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,18 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": false | ||
}, | ||
"target": "es2022", | ||
"loose": false, | ||
"minify": { | ||
"compress": false, | ||
"mangle": false | ||
} | ||
}, | ||
"module": { | ||
"type": "es6" | ||
}, | ||
"minify": false | ||
} |
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 async = "1" | ||
const foo = async | ||
function bar() { | ||
return 42 | ||
} |
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 async = "1"; | ||
const foo = async; | ||
function bar() { | ||
return 42; | ||
} |
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,18 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": false | ||
}, | ||
"target": "es2022", | ||
"loose": false, | ||
"minify": { | ||
"compress": false, | ||
"mangle": false | ||
} | ||
}, | ||
"module": { | ||
"type": "es6" | ||
}, | ||
"minify": false | ||
} |
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,3 @@ | ||
const async = "1" | ||
const foo = async | ||
x => x |
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,3 @@ | ||
const async = "1"; | ||
const foo = async; | ||
(x)=>x; |
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
2 changes: 2 additions & 0 deletions
2
crates/swc_ecma_parser/tests/errors/async-line-break/1/input.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,2 @@ | ||
foo = async | ||
() => 42 |
13 changes: 13 additions & 0 deletions
13
crates/swc_ecma_parser/tests/errors/async-line-break/1/input.js.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,13 @@ | ||
|
||
x Expected ';', '}' or <eof> | ||
,-[$DIR/tests/errors/async-line-break/1/input.js:2:1] | ||
2 | () => 42 | ||
: ^^ | ||
`---- | ||
|
||
Error: | ||
> This is the expression part of an expression statement | ||
,-[$DIR/tests/errors/async-line-break/1/input.js:1:1] | ||
1 | ,-> foo = async | ||
2 | `-> () => 42 | ||
`---- |
4 changes: 4 additions & 0 deletions
4
crates/swc_ecma_parser/tests/errors/async-line-break/2/input.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,4 @@ | ||
foo = async | ||
function() { | ||
return 42 | ||
} |
6 changes: 6 additions & 0 deletions
6
crates/swc_ecma_parser/tests/errors/async-line-break/2/input.js.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,6 @@ | ||
|
||
x Expected ident | ||
,-[$DIR/tests/errors/async-line-break/2/input.js:2:1] | ||
2 | function() { | ||
: ^ | ||
`---- |
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
381d273
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/minify/libraries/antd
1730029017
ns/iter (± 12777118
)1803387905
ns/iter (± 10731905
)0.96
es/full/minify/libraries/d3
398160500
ns/iter (± 1970498
)442339612
ns/iter (± 11302244
)0.90
es/full/minify/libraries/echarts
2160416219
ns/iter (± 12358103
)2212381443
ns/iter (± 8912272
)0.98
es/full/minify/libraries/jquery
89134250
ns/iter (± 278628
)90046860
ns/iter (± 220261
)0.99
es/full/minify/libraries/lodash
124533314
ns/iter (± 391432
)126810411
ns/iter (± 1223362
)0.98
es/full/minify/libraries/moment
52370140
ns/iter (± 351694
)52852821
ns/iter (± 178994
)0.99
es/full/minify/libraries/react
17234842
ns/iter (± 41914
)17334829
ns/iter (± 53581
)0.99
es/full/minify/libraries/terser
412639446
ns/iter (± 3364034
)446998003
ns/iter (± 5451917
)0.92
es/full/minify/libraries/three
512477045
ns/iter (± 6874615
)575775867
ns/iter (± 12171912
)0.89
es/full/minify/libraries/typescript
4132645825
ns/iter (± 20659969
)4218388674
ns/iter (± 72293123
)0.98
es/full/minify/libraries/victory
672852818
ns/iter (± 8441921
)786302102
ns/iter (± 11879969
)0.86
es/full/minify/libraries/vue
136107445
ns/iter (± 2153007
)143473547
ns/iter (± 1042879
)0.95
es/full/codegen/es3
34398
ns/iter (± 189
)34668
ns/iter (± 128
)0.99
es/full/codegen/es5
34419
ns/iter (± 135
)34685
ns/iter (± 134
)0.99
es/full/codegen/es2015
34386
ns/iter (± 443
)34704
ns/iter (± 134
)0.99
es/full/codegen/es2016
34345
ns/iter (± 150
)34699
ns/iter (± 154
)0.99
es/full/codegen/es2017
34389
ns/iter (± 247
)34709
ns/iter (± 151
)0.99
es/full/codegen/es2018
34384
ns/iter (± 150
)34666
ns/iter (± 132
)0.99
es/full/codegen/es2019
34380
ns/iter (± 146
)34730
ns/iter (± 123
)0.99
es/full/codegen/es2020
34395
ns/iter (± 146
)34691
ns/iter (± 129
)0.99
es/full/all/es3
194627119
ns/iter (± 1413985
)193509427
ns/iter (± 1263893
)1.01
es/full/all/es5
182297046
ns/iter (± 1152349
)182751894
ns/iter (± 1030950
)1.00
es/full/all/es2015
147477502
ns/iter (± 1627184
)145215766
ns/iter (± 727391
)1.02
es/full/all/es2016
145162409
ns/iter (± 1692399
)144443460
ns/iter (± 900259
)1.00
es/full/all/es2017
145145705
ns/iter (± 1699322
)143945431
ns/iter (± 1167526
)1.01
es/full/all/es2018
142831535
ns/iter (± 1443992
)142206688
ns/iter (± 960932
)1.00
es/full/all/es2019
142340888
ns/iter (± 1413232
)141332321
ns/iter (± 792448
)1.01
es/full/all/es2020
138999098
ns/iter (± 1775994
)136574555
ns/iter (± 1048986
)1.02
es/full/parser
576709
ns/iter (± 49874
)588630
ns/iter (± 57725
)0.98
es/full/base/fixer
26925
ns/iter (± 207
)28573
ns/iter (± 211
)0.94
es/full/base/resolver_and_hygiene
137687
ns/iter (± 1769
)139112
ns/iter (± 1713
)0.99
serialization of ast node
182
ns/iter (± 0
)181
ns/iter (± 0
)1.01
serialization of serde
182
ns/iter (± 0
)182
ns/iter (± 0
)1
This comment was automatically generated by workflow using github-action-benchmark.