Disallow await inside arrow functions (#9074)
* Disallow await inside arrow functions * Update test262 whitelist
This commit is contained in:
parent
9308c870f5
commit
61f2aed5b0
@ -1716,7 +1716,7 @@ export default class ExpressionParser extends LValParser {
|
|||||||
const oldInAsync = this.state.inAsync;
|
const oldInAsync = this.state.inAsync;
|
||||||
const oldInGenerator = this.state.inGenerator;
|
const oldInGenerator = this.state.inGenerator;
|
||||||
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
||||||
this.state.inAsync = true;
|
this.state.inAsync = isAsync;
|
||||||
this.state.inGenerator = false;
|
this.state.inGenerator = false;
|
||||||
this.state.maybeInArrowParameters = false;
|
this.state.maybeInArrowParameters = false;
|
||||||
this.parseFunctionBody(node, true);
|
this.parseFunctionBody(node, true);
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
() => { await x }
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"throws": "Unexpected token, expected \";\" (1:14)"
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
() => { await }
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"sourceType": "script"
|
||||||
|
}
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start": 0,
|
||||||
|
"end": 15,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start": 0,
|
||||||
|
"end": 15,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"start": 0,
|
||||||
|
"end": 15,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "ArrowFunctionExpression",
|
||||||
|
"start": 0,
|
||||||
|
"end": 15,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": null,
|
||||||
|
"generator": false,
|
||||||
|
"async": false,
|
||||||
|
"params": [],
|
||||||
|
"body": {
|
||||||
|
"type": "BlockStatement",
|
||||||
|
"start": 6,
|
||||||
|
"end": 15,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"start": 8,
|
||||||
|
"end": 13,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 8
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 8,
|
||||||
|
"end": 13,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 8
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13
|
||||||
|
},
|
||||||
|
"identifierName": "await"
|
||||||
|
},
|
||||||
|
"name": "await"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1654,8 +1654,6 @@ language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redec
|
|||||||
language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-async-generator-declaration.js(strict mode)
|
language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-async-generator-declaration.js(strict mode)
|
||||||
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js(default)
|
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js(default)
|
||||||
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js(strict mode)
|
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js(strict mode)
|
||||||
language/expressions/dynamic-import/assignment-expression/await-identifier.js(default)
|
|
||||||
language/expressions/dynamic-import/assignment-expression/await-identifier.js(strict mode)
|
|
||||||
language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js(default)
|
language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js(default)
|
||||||
language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js(strict mode)
|
language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js(strict mode)
|
||||||
language/literals/regexp/named-groups/invalid-dangling-groupname-2.js(default)
|
language/literals/regexp/named-groups/invalid-dangling-groupname-2.js(default)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user