forked from rome/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rslint_parser): Fix arrow parsing (rome#2284)
Allows parsing of single parameter async function where the parameter is named `async`
- Loading branch information
1 parent
1b303cf
commit 001bdaa
Showing
3 changed files
with
78 additions
and
5 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
1 change: 1 addition & 0 deletions
1
..._parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.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 @@ | ||
let id = async => async; |
65 changes: 65 additions & 0 deletions
65
...arser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast
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,65 @@ | ||
JsModule { | ||
interpreter_token: missing (optional), | ||
directives: JsDirectiveList [], | ||
items: JsModuleItemList [ | ||
JsVariableStatement { | ||
declaration: JsVariableDeclaration { | ||
kind: [email protected] "let" [] [Whitespace(" ")], | ||
declarators: JsVariableDeclaratorList [ | ||
JsVariableDeclarator { | ||
id: JsIdentifierBinding { | ||
name_token: [email protected] "id" [] [Whitespace(" ")], | ||
}, | ||
variable_annotation: missing (optional), | ||
initializer: JsInitializerClause { | ||
eq_token: [email protected] "=" [] [Whitespace(" ")], | ||
expression: JsArrowFunctionExpression { | ||
async_token: missing (optional), | ||
type_parameters: missing (optional), | ||
parameters: JsIdentifierBinding { | ||
name_token: [email protected] "async" [] [Whitespace(" ")], | ||
}, | ||
return_type_annotation: missing (optional), | ||
fat_arrow_token: [email protected] "=>" [] [Whitespace(" ")], | ||
body: JsIdentifierExpression { | ||
name: JsReferenceIdentifier { | ||
value_token: [email protected] "async" [] [], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
semicolon_token: [email protected] ";" [] [], | ||
}, | ||
], | ||
eof_token: [email protected] "" [Newline("\n")] [], | ||
} | ||
|
||
0: [email protected] | ||
0: (empty) | ||
1: [email protected] | ||
2: [email protected] | ||
0: [email protected] | ||
0: [email protected] | ||
0: [email protected] "let" [] [Whitespace(" ")] | ||
1: [email protected] | ||
0: [email protected] | ||
0: [email protected] | ||
0: [email protected] "id" [] [Whitespace(" ")] | ||
1: (empty) | ||
2: [email protected] | ||
0: [email protected] "=" [] [Whitespace(" ")] | ||
1: [email protected] | ||
0: (empty) | ||
1: (empty) | ||
2: [email protected] | ||
0: [email protected] "async" [] [Whitespace(" ")] | ||
3: (empty) | ||
4: [email protected] "=>" [] [Whitespace(" ")] | ||
5: [email protected] | ||
0: [email protected] | ||
0: [email protected] "async" [] [] | ||
1: [email protected] ";" [] [] | ||
3: [email protected] "" [Newline("\n")] [] |