Async generator (#613)

Change parser to accept async generator.

Closes #612.
This commit is contained in:
kdy1 2020-01-29 02:59:25 +00:00
parent 480015d407
commit d06eeed352
5 changed files with 97 additions and 3 deletions

View File

@ -760,9 +760,9 @@ impl<'a, I: Tokens> Parser<'a, I> {
let is_generator = {
let start = cur_pos!();
if eat!('*') {
if is_async {
syntax_error!(span!(start), SyntaxError::AsyncGenerator {});
}
// if is_async {
// syntax_error!(span!(start), SyntaxError::AsyncGenerator {});
// }
true
} else {
false

View File

@ -0,0 +1 @@
async function* agf() {}

View File

@ -0,0 +1,46 @@
{
"type": "Module",
"span": {
"start": 0,
"end": 24,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 16,
"end": 19,
"ctxt": 0
},
"value": "agf",
"typeAnnotation": null,
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 0,
"end": 24,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 22,
"end": 24,
"ctxt": 0
},
"stmts": []
},
"generator": true,
"async": true,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}

View File

@ -0,0 +1 @@
async function* agf() {}

View File

@ -0,0 +1,46 @@
{
"type": "Module",
"span": {
"start": 0,
"end": 24,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 16,
"end": 19,
"ctxt": 0
},
"value": "agf",
"typeAnnotation": null,
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 0,
"end": 24,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 22,
"end": 24,
"ctxt": 0
},
"stmts": []
},
"generator": true,
"async": true,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}