-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed parsing of async keyword as class method and field. Fixes #62
- Loading branch information
Showing
11 changed files
with
861 additions
and
4 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
13 changes: 13 additions & 0 deletions
13
test/Peast/Syntax/ES2017/files/AsyncAwait/ClassMethodNamedAsync.Render.txt
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 @@ | ||
class test { | ||
async () { | ||
} | ||
} | ||
/**************************************************/ | ||
class test{async(){}} | ||
/**************************************************/ | ||
class test | ||
{ | ||
async ( ) | ||
{ | ||
} | ||
} |
146 changes: 146 additions & 0 deletions
146
test/Peast/Syntax/ES2017/files/AsyncAwait/ClassMethodNamedAsync.Tokens.json
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,146 @@ | ||
[ | ||
{ | ||
"type": "Keyword", | ||
"value": "class", | ||
"location": { | ||
"start": { | ||
"line": 1, | ||
"column": 0, | ||
"index": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 5, | ||
"index": 5 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Identifier", | ||
"value": "test", | ||
"location": { | ||
"start": { | ||
"line": 1, | ||
"column": 6, | ||
"index": 6 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 10, | ||
"index": 10 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Punctuator", | ||
"value": "{", | ||
"location": { | ||
"start": { | ||
"line": 1, | ||
"column": 11, | ||
"index": 11 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 12, | ||
"index": 12 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Identifier", | ||
"value": "async", | ||
"location": { | ||
"start": { | ||
"line": 2, | ||
"column": 4, | ||
"index": 17 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 9, | ||
"index": 22 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Punctuator", | ||
"value": "(", | ||
"location": { | ||
"start": { | ||
"line": 2, | ||
"column": 10, | ||
"index": 23 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 11, | ||
"index": 24 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Punctuator", | ||
"value": ")", | ||
"location": { | ||
"start": { | ||
"line": 2, | ||
"column": 11, | ||
"index": 24 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 12, | ||
"index": 25 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Punctuator", | ||
"value": "{", | ||
"location": { | ||
"start": { | ||
"line": 2, | ||
"column": 12, | ||
"index": 25 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 13, | ||
"index": 26 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Punctuator", | ||
"value": "}", | ||
"location": { | ||
"start": { | ||
"line": 2, | ||
"column": 13, | ||
"index": 26 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 14, | ||
"index": 27 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Punctuator", | ||
"value": "}", | ||
"location": { | ||
"start": { | ||
"line": 3, | ||
"column": 0, | ||
"index": 28 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 1, | ||
"index": 29 | ||
} | ||
} | ||
} | ||
] |
3 changes: 3 additions & 0 deletions
3
test/Peast/Syntax/ES2017/files/AsyncAwait/ClassMethodNamedAsync.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,3 @@ | ||
class test { | ||
async (){} | ||
} |
154 changes: 154 additions & 0 deletions
154
test/Peast/Syntax/ES2017/files/AsyncAwait/ClassMethodNamedAsync.json
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,154 @@ | ||
{ | ||
"type": "Program", | ||
"location": { | ||
"start": { | ||
"line": 1, | ||
"column": 0, | ||
"index": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 1, | ||
"index": 29 | ||
} | ||
}, | ||
"leadingComments": [], | ||
"trailingComments": [], | ||
"body": [ | ||
{ | ||
"type": "ClassDeclaration", | ||
"location": { | ||
"start": { | ||
"line": 1, | ||
"column": 0, | ||
"index": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 1, | ||
"index": 29 | ||
} | ||
}, | ||
"leadingComments": [], | ||
"trailingComments": [], | ||
"id": { | ||
"type": "Identifier", | ||
"location": { | ||
"start": { | ||
"line": 1, | ||
"column": 6, | ||
"index": 6 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 10, | ||
"index": 10 | ||
} | ||
}, | ||
"leadingComments": [], | ||
"trailingComments": [], | ||
"name": "test", | ||
"rawName": "test" | ||
}, | ||
"superClass": null, | ||
"body": { | ||
"type": "ClassBody", | ||
"location": { | ||
"start": { | ||
"line": 1, | ||
"column": 11, | ||
"index": 11 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 1, | ||
"index": 29 | ||
} | ||
}, | ||
"leadingComments": [], | ||
"trailingComments": [], | ||
"body": [ | ||
{ | ||
"type": "MethodDefinition", | ||
"location": { | ||
"start": { | ||
"line": 2, | ||
"column": 4, | ||
"index": 17 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 14, | ||
"index": 27 | ||
} | ||
}, | ||
"leadingComments": [], | ||
"trailingComments": [], | ||
"key": { | ||
"type": "Identifier", | ||
"location": { | ||
"start": { | ||
"line": 2, | ||
"column": 4, | ||
"index": 17 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 9, | ||
"index": 22 | ||
} | ||
}, | ||
"leadingComments": [], | ||
"trailingComments": [], | ||
"name": "async", | ||
"rawName": "async" | ||
}, | ||
"value": { | ||
"type": "FunctionExpression", | ||
"location": { | ||
"start": { | ||
"line": 2, | ||
"column": 10, | ||
"index": 23 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 14, | ||
"index": 27 | ||
} | ||
}, | ||
"leadingComments": [], | ||
"trailingComments": [], | ||
"id": null, | ||
"params": [], | ||
"body": { | ||
"type": "BlockStatement", | ||
"location": { | ||
"start": { | ||
"line": 2, | ||
"column": 12, | ||
"index": 25 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 14, | ||
"index": 27 | ||
} | ||
}, | ||
"leadingComments": [], | ||
"trailingComments": [], | ||
"body": [] | ||
}, | ||
"generator": false, | ||
"async": false | ||
}, | ||
"kind": "method", | ||
"computed": false, | ||
"static": false | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"sourceType": "script" | ||
} |
3 changes: 3 additions & 0 deletions
3
test/Peast/Syntax/ES2018/files/AsyncAwait/InvalidAsyncGenerator.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,3 @@ | ||
class test { | ||
async *(){} | ||
} |
2 changes: 2 additions & 0 deletions
2
test/Peast/Syntax/ES2018/files/AsyncAwait/InvalidAsyncGenerator2.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 @@ | ||
async function *(param) { | ||
} |
17 changes: 17 additions & 0 deletions
17
test/Peast/Syntax/ES2022/files/ClassFields/ClassFields6.Render.txt
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,17 @@ | ||
class test { | ||
async; | ||
async = 1; | ||
async fn () { | ||
} | ||
} | ||
/**************************************************/ | ||
class test{async;async=1;async fn(){}} | ||
/**************************************************/ | ||
class test | ||
{ | ||
async; | ||
async = 1; | ||
async fn ( ) | ||
{ | ||
} | ||
} |
Oops, something went wrong.