Fix await binding error within static block (#13088)
* fix: allow await within SCOPE_FUNCTION under static block * perf: scan scopeStack for once * add new test case * chore: update allowlist
This commit is contained in:
parent
1c7da020e4
commit
6e57617138
@ -2385,7 +2385,7 @@ export default class ExpressionParser extends LValParser {
|
||||
if (this.prodParam.hasAwait) {
|
||||
this.raise(startLoc, Errors.AwaitBindingIdentifier);
|
||||
return;
|
||||
} else if (this.scope.inStaticBlock && !this.scope.inNonArrowFunction) {
|
||||
} else if (this.scope.inStaticBlock) {
|
||||
this.raise(startLoc, Errors.AwaitBindingIdentifierInStaticBlock);
|
||||
return;
|
||||
} else {
|
||||
|
||||
@ -65,7 +65,16 @@ export default class ScopeHandler<IScope: Scope = Scope> {
|
||||
return (flags & SCOPE_CLASS) > 0 && (flags & SCOPE_FUNCTION) === 0;
|
||||
}
|
||||
get inStaticBlock() {
|
||||
return (this.currentThisScopeFlags() & SCOPE_STATIC_BLOCK) > 0;
|
||||
for (let i = this.scopeStack.length - 1; ; i--) {
|
||||
const { flags } = this.scopeStack[i];
|
||||
if (flags & SCOPE_STATIC_BLOCK) {
|
||||
return true;
|
||||
}
|
||||
if (flags & (SCOPE_VAR | SCOPE_CLASS)) {
|
||||
// function body, module body, class property initializers
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
get inNonArrowFunction() {
|
||||
return (this.currentThisScopeFlags() & SCOPE_FUNCTION) > 0;
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
var C;
|
||||
// await in body is allowed
|
||||
C = class { static { () => await } };
|
||||
@ -0,0 +1,100 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":37}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":72,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":37}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " await in body is allowed",
|
||||
"start":7,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}
|
||||
}
|
||||
],
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"C"},
|
||||
"name": "C"
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":35,"end":72,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":37}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " await in body is allowed",
|
||||
"start":7,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":35,"end":71,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":36}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":35,"end":36,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":1},"identifierName":"C"},
|
||||
"name": "C"
|
||||
},
|
||||
"right": {
|
||||
"type": "ClassExpression",
|
||||
"start":39,"end":71,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":36}},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":45,"end":71,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":36}},
|
||||
"body": [
|
||||
{
|
||||
"type": "StaticBlock",
|
||||
"start":47,"end":69,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":34}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":56,"end":67,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":32}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":56,"end":67,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":32}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "Identifier",
|
||||
"start":62,"end":67,"loc":{"start":{"line":3,"column":27},"end":{"line":3,"column":32},"identifierName":"await"},
|
||||
"name": "await"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " await in body is allowed",
|
||||
"start":7,"end":34,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
var C;
|
||||
// await is not allowed in async arrow
|
||||
C = class { static { async (await) => {} } };
|
||||
|
||||
C = class { static { async (x = await) => {} } };
|
||||
|
||||
C = class { static { async ({ [await]: x }) => {} } };
|
||||
@ -0,0 +1,251 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":198,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":54}},
|
||||
"errors": [
|
||||
"SyntaxError: Can not use 'await' as identifier inside a static block. (3:28)",
|
||||
"SyntaxError: Can not use 'await' as identifier inside a static block. (5:32)",
|
||||
"SyntaxError: Can not use 'await' as identifier inside a static block. (7:31)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":198,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":54}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " await is not allowed in async arrow",
|
||||
"start":7,"end":45,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":38}}
|
||||
}
|
||||
],
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"C"},
|
||||
"name": "C"
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":46,"end":91,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":45}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " await is not allowed in async arrow",
|
||||
"start":7,"end":45,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":38}}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":46,"end":90,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":44}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":46,"end":47,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":1},"identifierName":"C"},
|
||||
"name": "C"
|
||||
},
|
||||
"right": {
|
||||
"type": "ClassExpression",
|
||||
"start":50,"end":90,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":44}},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":56,"end":90,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":44}},
|
||||
"body": [
|
||||
{
|
||||
"type": "StaticBlock",
|
||||
"start":58,"end":88,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":42}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":67,"end":86,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":40}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":67,"end":86,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":40}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":74,"end":79,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":33},"identifierName":"await"},
|
||||
"name": "await"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":84,"end":86,"loc":{"start":{"line":3,"column":38},"end":{"line":3,"column":40}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":93,"end":142,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":49}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":93,"end":141,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":48}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":93,"end":94,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":1},"identifierName":"C"},
|
||||
"name": "C"
|
||||
},
|
||||
"right": {
|
||||
"type": "ClassExpression",
|
||||
"start":97,"end":141,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":48}},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":103,"end":141,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":48}},
|
||||
"body": [
|
||||
{
|
||||
"type": "StaticBlock",
|
||||
"start":105,"end":139,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":46}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":114,"end":137,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":44}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":114,"end":137,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":44}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":121,"end":130,"loc":{"start":{"line":5,"column":28},"end":{"line":5,"column":37}},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":121,"end":122,"loc":{"start":{"line":5,"column":28},"end":{"line":5,"column":29},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Identifier",
|
||||
"start":125,"end":130,"loc":{"start":{"line":5,"column":32},"end":{"line":5,"column":37},"identifierName":"await"},
|
||||
"name": "await"
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":135,"end":137,"loc":{"start":{"line":5,"column":42},"end":{"line":5,"column":44}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":144,"end":198,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":54}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":144,"end":197,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":53}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":144,"end":145,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":1},"identifierName":"C"},
|
||||
"name": "C"
|
||||
},
|
||||
"right": {
|
||||
"type": "ClassExpression",
|
||||
"start":148,"end":197,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":53}},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":154,"end":197,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":53}},
|
||||
"body": [
|
||||
{
|
||||
"type": "StaticBlock",
|
||||
"start":156,"end":195,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":51}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":165,"end":193,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":49}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":165,"end":193,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":49}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "ObjectPattern",
|
||||
"start":172,"end":186,"loc":{"start":{"line":7,"column":28},"end":{"line":7,"column":42}},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start":174,"end":184,"loc":{"start":{"line":7,"column":30},"end":{"line":7,"column":40}},
|
||||
"method": false,
|
||||
"computed": true,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":175,"end":180,"loc":{"start":{"line":7,"column":31},"end":{"line":7,"column":36},"identifierName":"await"},
|
||||
"name": "await"
|
||||
},
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "Identifier",
|
||||
"start":183,"end":184,"loc":{"start":{"line":7,"column":39},"end":{"line":7,"column":40},"identifierName":"x"},
|
||||
"name": "x"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":191,"end":193,"loc":{"start":{"line":7,"column":47},"end":{"line":7,"column":49}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " await is not allowed in async arrow",
|
||||
"start":7,"end":45,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":38}}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -7,3 +7,5 @@ C = class { static { function f(await) {} } };
|
||||
C = class { static { function f(x = await) {} } };
|
||||
|
||||
C = class { static { function f({ [await]: x }) {} } };
|
||||
// await in function expression is allowed
|
||||
C = class { static { (function await() {}) } };
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":213,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":55}},
|
||||
"start":0,"end":304,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":47}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":213,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":55}},
|
||||
"start":0,"end":304,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":47}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
@ -208,6 +208,13 @@
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":158,"end":213,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":55}},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " await in function expression is allowed",
|
||||
"start":214,"end":256,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":42}}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":158,"end":212,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":54}},
|
||||
@ -278,8 +285,80 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":257,"end":304,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":47}},
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " await in function expression is allowed",
|
||||
"start":214,"end":256,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":42}}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":257,"end":303,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":46}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":257,"end":258,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":1},"identifierName":"C"},
|
||||
"name": "C"
|
||||
},
|
||||
"right": {
|
||||
"type": "ClassExpression",
|
||||
"start":261,"end":303,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":46}},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":267,"end":303,"loc":{"start":{"line":11,"column":10},"end":{"line":11,"column":46}},
|
||||
"body": [
|
||||
{
|
||||
"type": "StaticBlock",
|
||||
"start":269,"end":301,"loc":{"start":{"line":11,"column":12},"end":{"line":11,"column":44}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":278,"end":299,"loc":{"start":{"line":11,"column":21},"end":{"line":11,"column":42}},
|
||||
"expression": {
|
||||
"type": "FunctionExpression",
|
||||
"start":279,"end":298,"loc":{"start":{"line":11,"column":22},"end":{"line":11,"column":41}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 278
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":288,"end":293,"loc":{"start":{"line":11,"column":31},"end":{"line":11,"column":36},"identifierName":"await"},
|
||||
"name": "await"
|
||||
},
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":296,"end":298,"loc":{"start":{"line":11,"column":39},"end":{"line":11,"column":41}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " await in function expression is allowed",
|
||||
"start":214,"end":256,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":42}}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
var C;
|
||||
|
||||
C = class { static { class D { x = await } } };
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"plugins": [
|
||||
"classStaticBlock",
|
||||
"classProperties"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":47}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":47}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"C"},
|
||||
"name": "C"
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":8,"end":55,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":47}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":8,"end":54,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":46}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":8,"end":9,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":1},"identifierName":"C"},
|
||||
"name": "C"
|
||||
},
|
||||
"right": {
|
||||
"type": "ClassExpression",
|
||||
"start":12,"end":54,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":46}},
|
||||
"id": null,
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":18,"end":54,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":46}},
|
||||
"body": [
|
||||
{
|
||||
"type": "StaticBlock",
|
||||
"start":20,"end":52,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":44}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start":29,"end":50,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":42}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":35,"end":36,"loc":{"start":{"line":3,"column":27},"end":{"line":3,"column":28},"identifierName":"D"},
|
||||
"name": "D"
|
||||
},
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":37,"end":50,"loc":{"start":{"line":3,"column":29},"end":{"line":3,"column":42}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassProperty",
|
||||
"start":39,"end":48,"loc":{"start":{"line":3,"column":31},"end":{"line":3,"column":40}},
|
||||
"static": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":39,"end":40,"loc":{"start":{"line":3,"column":31},"end":{"line":3,"column":32},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"computed": false,
|
||||
"value": {
|
||||
"type": "Identifier",
|
||||
"start":43,"end":48,"loc":{"start":{"line":3,"column":35},"end":{"line":3,"column":40},"identifierName":"await"},
|
||||
"name": "await"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,27 +1,29 @@
|
||||
var C;
|
||||
|
||||
// This file enumerates all the disallowed cases, for allowed cases, see await-binding-*
|
||||
C = class { static { await } };
|
||||
|
||||
C = class { static { () => await } };
|
||||
|
||||
C = class { static { (await) => {} } };
|
||||
|
||||
C = class { static { (await) } };
|
||||
|
||||
C = class { static { async (await) => {} } };
|
||||
|
||||
C = class { static { async (await) } };
|
||||
|
||||
C = class { static { ({ [await]: x}) => {} } };
|
||||
|
||||
C = class { static { ({ [await]: x}) } };
|
||||
|
||||
C = class { static { async ({ [await]: x}) => {} } };
|
||||
|
||||
C = class { static { async ({ [await]: x}) } };
|
||||
|
||||
async (x = class { static { await } }) => {};
|
||||
|
||||
C = class { static { function await() {} } };
|
||||
|
||||
// await as label is not allowed
|
||||
C = class { static { await: 0 } };
|
||||
|
||||
C = class { static { class D { [await] } } };
|
||||
// await binding in function declaration is not allowed
|
||||
C = class { static { function await() {} } };
|
||||
// await binding in class declaration is not allowed
|
||||
C = class { static { class await {} } };
|
||||
// await binding in class expression is not allowed
|
||||
C = class { static { (class await {}) } };
|
||||
// await in arrow parameters is not allowed
|
||||
C = class { static { (await) => {} } };
|
||||
|
||||
C = class { static { (x = await) => {} } };
|
||||
|
||||
C = class { static { ({ [await]: x }) => {} } };
|
||||
|
||||
C = class { static { { await } } };
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["classStaticBlock", "classProperties"]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,22 +1,4 @@
|
||||
language/expressions/object/identifier-shorthand-static-init-await-valid.js(default)
|
||||
language/expressions/object/identifier-shorthand-static-init-await-valid.js(strict mode)
|
||||
language/import/json-invalid.js(default)
|
||||
language/import/json-invalid.js(strict mode)
|
||||
language/import/json-named-bindings.js(default)
|
||||
language/import/json-named-bindings.js(strict mode)
|
||||
language/statements/class/static-init-await-binding-valid.js(default)
|
||||
language/statements/class/static-init-await-binding-valid.js(strict mode)
|
||||
language/statements/const/static-init-await-binding-valid.js(default)
|
||||
language/statements/const/static-init-await-binding-valid.js(strict mode)
|
||||
language/statements/function/static-init-await-binding-valid.js(default)
|
||||
language/statements/function/static-init-await-binding-valid.js(strict mode)
|
||||
language/statements/let/static-init-await-binding-valid.js(default)
|
||||
language/statements/let/static-init-await-binding-valid.js(strict mode)
|
||||
language/statements/try/static-init-await-binding-valid.js(default)
|
||||
language/statements/try/static-init-await-binding-valid.js(strict mode)
|
||||
language/statements/variable/dstr/ary-ptrn-elem-id-static-init-await-valid.js(default)
|
||||
language/statements/variable/dstr/ary-ptrn-elem-id-static-init-await-valid.js(strict mode)
|
||||
language/statements/variable/dstr/obj-ptrn-elem-id-static-init-await-valid.js(default)
|
||||
language/statements/variable/dstr/obj-ptrn-elem-id-static-init-await-valid.js(strict mode)
|
||||
language/statements/variable/static-init-await-binding-valid.js(default)
|
||||
language/statements/variable/static-init-await-binding-valid.js(strict mode)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user