Closed Shilpi3 closed 5 years ago
The scripts ``async ({await}) => 1 async function x({await}) { return 1 }
``async ({await}) => 1
should throw an error in the parser. Instead, it is parsed as the following AST. { "type": "Script", "directives": [], "statements": [ { "type": "ExpressionStatement", "expression": { "type": "ArrowExpression", "isAsync": true, "params": { "type": "FormalParameters", "items": [ { "type": "ObjectBinding", "properties": [ { "type": "BindingPropertyIdentifier", "binding": { "type": "BindingIdentifier", "name": "await" }, "init": null } ] } ], "rest": null }, "body": { "type": "LiteralNumericExpression", "value": 1 } } } ] }
The script does not throw an early Error as well.
It's also incorrectly allowed in the body of async functions:
async function f() { return { await }; }
should be a parse error, but is not.
Fixed by #418.
The scripts
``async ({await}) => 1
async function x({await}) { return 1 }The script does not throw an early Error as well.