Skip to content

Commit

Permalink
Async generator (#613)
Browse files Browse the repository at this point in the history
Change parser to accept async generator.

Closes #612.
  • Loading branch information
kdy1 committed Jan 29, 2020
1 parent 480015d commit d06eeed
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ecmascript/parser/src/parser/class_and_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
async function* agf() {}
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
async function* agf() {}
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit d06eeed

Please sign in to comment.