Skip to content

Commit

Permalink
Remove empty expression in expression statement with top level await (#…
Browse files Browse the repository at this point in the history
…630)

Eats the semi-colon.

This doesn't compile though because the target of that folder is ES2015. Also, this is kind of strange for me to put the tests in the "typescript" folder. Should we create something more general?

You can take over this PR if you'd like!
  • Loading branch information
dsherret committed Feb 6, 2020
1 parent bf5cff1 commit 9a21caa
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions ecmascript/parser/src/parser/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ impl<'a, I: Tokens> Parser<'a, I> {
}

let expr = self.parse_await_expr()?;
eat!(';');

let span = span!(start);
return Ok(Stmt::Expr(ExprStmt { span, expr }));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
await test ;
38 changes: 38 additions & 0 deletions ecmascript/parser/tests/typescript/await-expression/input.ts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"type": "Module",
"span": {
"start": 0,
"end": 17,
"ctxt": 0
},
"body": [
{
"type": "ExpressionStatement",
"span": {
"start": 0,
"end": 17,
"ctxt": 0
},
"expression": {
"type": "AwaitExpression",
"span": {
"start": 0,
"end": 13,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 9,
"end": 13,
"ctxt": 0
},
"value": "test",
"typeAnnotation": null,
"optional": false
}
}
}
],
"interpreter": null
}

0 comments on commit 9a21caa

Please sign in to comment.