From ce0c08f18c9742b2f75504d4c1d634c584990411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Thu, 1 Apr 2021 18:45:24 -0400 Subject: [PATCH] fix: allow await within SCOPE_FUNCTION under static block --- .../babel-parser/src/parser/expression.js | 2 +- .../input.js | 9 + .../output.json | 279 +++++++++ .../input.js | 7 + .../output.json | 230 +++++++ .../input.js | 2 + .../output.json | 56 +- .../input.js | 3 + .../options.json | 6 + .../output.json | 94 +++ .../await-binding-in-static-block/input.js | 16 +- .../options.json | 3 + .../await-binding-in-static-block/output.json | 570 ++++-------------- 13 files changed, 790 insertions(+), 487 deletions(-) create mode 100644 packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-arrow-function-in-static-block copy/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-arrow-function-in-static-block copy/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-async-arrow-function-in-static-block/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-async-arrow-function-in-static-block/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/options.json diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 9a3271a8262b..71e809d8cd92 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -2350,7 +2350,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.scope.inFunction) { this.raise(startLoc, Errors.AwaitBindingIdentifierInStaticBlock); return; } else { diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-arrow-function-in-static-block copy/input.js b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-arrow-function-in-static-block copy/input.js new file mode 100644 index 000000000000..776042f4e385 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-arrow-function-in-static-block copy/input.js @@ -0,0 +1,9 @@ +var C; + +C = class { static { () => await } }; + +C = class { static { (await) => {} } }; + +C = class { static { (x = await) => {} } }; + +C = class { static { ({ [await]: x }) => {} } }; diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-arrow-function-in-static-block copy/output.json b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-arrow-function-in-static-block copy/output.json new file mode 100644 index 000000000000..1b0626b32061 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-arrow-function-in-static-block copy/output.json @@ -0,0 +1,279 @@ +{ + "type": "File", + "start":0,"end":181,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":48}}, + "errors": [ + "SyntaxError: Can not use 'await' as identifier inside a static block (5:22)", + "SyntaxError: Can not use 'await' as identifier inside a static block (7:26)", + "SyntaxError: Can not use 'await' as identifier inside a static block (9:25)" + ], + "program": { + "type": "Program", + "start":0,"end":181,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":48}}, + "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":45,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":37}}, + "expression": { + "type": "AssignmentExpression", + "start":8,"end":44,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":36}}, + "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":44,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":36}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":18,"end":44,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":36}}, + "body": [ + { + "type": "StaticBlock", + "start":20,"end":42,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":34}}, + "body": [ + { + "type": "ExpressionStatement", + "start":29,"end":40,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":32}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":29,"end":40,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":32}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "Identifier", + "start":35,"end":40,"loc":{"start":{"line":3,"column":27},"end":{"line":3,"column":32},"identifierName":"await"}, + "name": "await" + } + } + } + ] + } + ] + } + } + } + }, + { + "type": "ExpressionStatement", + "start":47,"end":86,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":39}}, + "expression": { + "type": "AssignmentExpression", + "start":47,"end":85,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":38}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":47,"end":48,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":1},"identifierName":"C"}, + "name": "C" + }, + "right": { + "type": "ClassExpression", + "start":51,"end":85,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":38}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":57,"end":85,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":38}}, + "body": [ + { + "type": "StaticBlock", + "start":59,"end":83,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":36}}, + "body": [ + { + "type": "ExpressionStatement", + "start":68,"end":81,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":34}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":68,"end":81,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":34}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":69,"end":74,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":27},"identifierName":"await"}, + "name": "await" + } + ], + "body": { + "type": "BlockStatement", + "start":79,"end":81,"loc":{"start":{"line":5,"column":32},"end":{"line":5,"column":34}}, + "body": [], + "directives": [] + } + } + } + ] + } + ] + } + } + } + }, + { + "type": "ExpressionStatement", + "start":88,"end":131,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":43}}, + "expression": { + "type": "AssignmentExpression", + "start":88,"end":130,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":42}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":88,"end":89,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":1},"identifierName":"C"}, + "name": "C" + }, + "right": { + "type": "ClassExpression", + "start":92,"end":130,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":42}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":98,"end":130,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":42}}, + "body": [ + { + "type": "StaticBlock", + "start":100,"end":128,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":40}}, + "body": [ + { + "type": "ExpressionStatement", + "start":109,"end":126,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":38}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":109,"end":126,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":38}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":110,"end":119,"loc":{"start":{"line":7,"column":22},"end":{"line":7,"column":31}}, + "left": { + "type": "Identifier", + "start":110,"end":111,"loc":{"start":{"line":7,"column":22},"end":{"line":7,"column":23},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "Identifier", + "start":114,"end":119,"loc":{"start":{"line":7,"column":26},"end":{"line":7,"column":31},"identifierName":"await"}, + "name": "await" + } + } + ], + "body": { + "type": "BlockStatement", + "start":124,"end":126,"loc":{"start":{"line":7,"column":36},"end":{"line":7,"column":38}}, + "body": [], + "directives": [] + } + } + } + ] + } + ] + } + } + } + }, + { + "type": "ExpressionStatement", + "start":133,"end":181,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":48}}, + "expression": { + "type": "AssignmentExpression", + "start":133,"end":180,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":47}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":133,"end":134,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":1},"identifierName":"C"}, + "name": "C" + }, + "right": { + "type": "ClassExpression", + "start":137,"end":180,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":47}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":143,"end":180,"loc":{"start":{"line":9,"column":10},"end":{"line":9,"column":47}}, + "body": [ + { + "type": "StaticBlock", + "start":145,"end":178,"loc":{"start":{"line":9,"column":12},"end":{"line":9,"column":45}}, + "body": [ + { + "type": "ExpressionStatement", + "start":154,"end":176,"loc":{"start":{"line":9,"column":21},"end":{"line":9,"column":43}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":154,"end":176,"loc":{"start":{"line":9,"column":21},"end":{"line":9,"column":43}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":155,"end":169,"loc":{"start":{"line":9,"column":22},"end":{"line":9,"column":36}}, + "properties": [ + { + "type": "ObjectProperty", + "start":157,"end":167,"loc":{"start":{"line":9,"column":24},"end":{"line":9,"column":34}}, + "method": false, + "computed": true, + "key": { + "type": "Identifier", + "start":158,"end":163,"loc":{"start":{"line":9,"column":25},"end":{"line":9,"column":30},"identifierName":"await"}, + "name": "await" + }, + "shorthand": false, + "value": { + "type": "Identifier", + "start":166,"end":167,"loc":{"start":{"line":9,"column":33},"end":{"line":9,"column":34},"identifierName":"x"}, + "name": "x" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":174,"end":176,"loc":{"start":{"line":9,"column":41},"end":{"line":9,"column":43}}, + "body": [], + "directives": [] + } + } + } + ] + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-async-arrow-function-in-static-block/input.js b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-async-arrow-function-in-static-block/input.js new file mode 100644 index 000000000000..94d7b0f340ef --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-async-arrow-function-in-static-block/input.js @@ -0,0 +1,7 @@ +var C; + +C = class { static { async (await) => {} } }; + +C = class { static { async (x = await) => {} } }; + +C = class { static { async ({ [await]: x }) => {} } }; diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-async-arrow-function-in-static-block/output.json b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-async-arrow-function-in-static-block/output.json new file mode 100644 index 000000000000..74f7a8654656 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-async-arrow-function-in-static-block/output.json @@ -0,0 +1,230 @@ +{ + "type": "File", + "start":0,"end":160,"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":160,"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}}, + "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":53,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":45}}, + "expression": { + "type": "AssignmentExpression", + "start":8,"end":52,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":44}}, + "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":52,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":44}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":18,"end":52,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":44}}, + "body": [ + { + "type": "StaticBlock", + "start":20,"end":50,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":42}}, + "body": [ + { + "type": "ExpressionStatement", + "start":29,"end":48,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":40}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":29,"end":48,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":40}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "Identifier", + "start":36,"end":41,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":33},"identifierName":"await"}, + "name": "await" + } + ], + "body": { + "type": "BlockStatement", + "start":46,"end":48,"loc":{"start":{"line":3,"column":38},"end":{"line":3,"column":40}}, + "body": [], + "directives": [] + } + } + } + ] + } + ] + } + } + } + }, + { + "type": "ExpressionStatement", + "start":55,"end":104,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":49}}, + "expression": { + "type": "AssignmentExpression", + "start":55,"end":103,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":48}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":55,"end":56,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":1},"identifierName":"C"}, + "name": "C" + }, + "right": { + "type": "ClassExpression", + "start":59,"end":103,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":48}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":65,"end":103,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":48}}, + "body": [ + { + "type": "StaticBlock", + "start":67,"end":101,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":46}}, + "body": [ + { + "type": "ExpressionStatement", + "start":76,"end":99,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":44}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":76,"end":99,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":44}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start":83,"end":92,"loc":{"start":{"line":5,"column":28},"end":{"line":5,"column":37}}, + "left": { + "type": "Identifier", + "start":83,"end":84,"loc":{"start":{"line":5,"column":28},"end":{"line":5,"column":29},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "Identifier", + "start":87,"end":92,"loc":{"start":{"line":5,"column":32},"end":{"line":5,"column":37},"identifierName":"await"}, + "name": "await" + } + } + ], + "body": { + "type": "BlockStatement", + "start":97,"end":99,"loc":{"start":{"line":5,"column":42},"end":{"line":5,"column":44}}, + "body": [], + "directives": [] + } + } + } + ] + } + ] + } + } + } + }, + { + "type": "ExpressionStatement", + "start":106,"end":160,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":54}}, + "expression": { + "type": "AssignmentExpression", + "start":106,"end":159,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":53}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":106,"end":107,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":1},"identifierName":"C"}, + "name": "C" + }, + "right": { + "type": "ClassExpression", + "start":110,"end":159,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":53}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":116,"end":159,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":53}}, + "body": [ + { + "type": "StaticBlock", + "start":118,"end":157,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":51}}, + "body": [ + { + "type": "ExpressionStatement", + "start":127,"end":155,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":49}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":127,"end":155,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":49}}, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "ObjectPattern", + "start":134,"end":148,"loc":{"start":{"line":7,"column":28},"end":{"line":7,"column":42}}, + "properties": [ + { + "type": "ObjectProperty", + "start":136,"end":146,"loc":{"start":{"line":7,"column":30},"end":{"line":7,"column":40}}, + "method": false, + "computed": true, + "key": { + "type": "Identifier", + "start":137,"end":142,"loc":{"start":{"line":7,"column":31},"end":{"line":7,"column":36},"identifierName":"await"}, + "name": "await" + }, + "shorthand": false, + "value": { + "type": "Identifier", + "start":145,"end":146,"loc":{"start":{"line":7,"column":39},"end":{"line":7,"column":40},"identifierName":"x"}, + "name": "x" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start":153,"end":155,"loc":{"start":{"line":7,"column":47},"end":{"line":7,"column":49}}, + "body": [], + "directives": [] + } + } + } + ] + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-function-in-static-block/input.js b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-function-in-static-block/input.js index d35f8544e20c..d99f6898188a 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-function-in-static-block/input.js +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-function-in-static-block/input.js @@ -7,3 +7,5 @@ C = class { static { function f(await) {} } }; C = class { static { function f(x = await) {} } }; C = class { static { function f({ [await]: x }) {} } }; + +C = class { static { function await() {} } }; diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-function-in-static-block/output.json b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-function-in-static-block/output.json index 8468c2f86fdd..7907f7a414f4 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-function-in-static-block/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-function-in-static-block/output.json @@ -1,9 +1,9 @@ { "type": "File", - "start":0,"end":213,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":55}}, + "start":0,"end":260,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":45}}, "program": { "type": "Program", - "start":0,"end":213,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":55}}, + "start":0,"end":260,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":45}}, "sourceType": "script", "interpreter": null, "body": [ @@ -278,8 +278,58 @@ } } } + }, + { + "type": "ExpressionStatement", + "start":215,"end":260,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":45}}, + "expression": { + "type": "AssignmentExpression", + "start":215,"end":259,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":44}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":215,"end":216,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":1},"identifierName":"C"}, + "name": "C" + }, + "right": { + "type": "ClassExpression", + "start":219,"end":259,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":44}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":225,"end":259,"loc":{"start":{"line":11,"column":10},"end":{"line":11,"column":44}}, + "body": [ + { + "type": "StaticBlock", + "start":227,"end":257,"loc":{"start":{"line":11,"column":12},"end":{"line":11,"column":42}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":236,"end":255,"loc":{"start":{"line":11,"column":21},"end":{"line":11,"column":40}}, + "id": { + "type": "Identifier", + "start":245,"end":250,"loc":{"start":{"line":11,"column":30},"end":{"line":11,"column":35},"identifierName":"await"}, + "name": "await" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":253,"end":255,"loc":{"start":{"line":11,"column":38},"end":{"line":11,"column":40}}, + "body": [], + "directives": [] + } + } + ] + } + ] + } + } + } } ], "directives": [] } -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/input.js b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/input.js new file mode 100644 index 000000000000..bed6eababd56 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/input.js @@ -0,0 +1,3 @@ +var C; + +C = class { static { class D { x = await } } }; diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/options.json b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/options.json new file mode 100644 index 000000000000..f12f46a4196c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "classStaticBlock", + "classProperties" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/output.json b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/output.json new file mode 100644 index 000000000000..77baeecac2fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-initializer-in-static-block/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/input.js b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/input.js index 1813534f9131..8f03cd660f3a 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/input.js +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/input.js @@ -2,26 +2,14 @@ var C; 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() {} } }; - C = class { static { await: 0 } }; + +C = class { static { class D { [await] } } }; diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/options.json b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/options.json new file mode 100644 index 000000000000..3b03f5fe57cd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classStaticBlock", "classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/output.json b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/output.json index c3fb984ad5a4..3a5f5ce46f74 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/output.json +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/await-binding-in-static-block/output.json @@ -1,24 +1,18 @@ { "type": "File", - "start":0,"end":568,"loc":{"start":{"line":1,"column":0},"end":{"line":27,"column":34}}, + "start":0,"end":294,"loc":{"start":{"line":1,"column":0},"end":{"line":15,"column":45}}, "errors": [ "SyntaxError: Can not use 'await' as identifier inside a static block (3:21)", - "SyntaxError: Can not use 'await' as identifier inside a static block (5:27)", - "SyntaxError: Can not use 'await' as identifier inside a static block (7:22)", - "SyntaxError: Can not use 'await' as identifier inside a static block (9:22)", + "SyntaxError: Can not use 'await' as identifier inside a static block (5:22)", + "SyntaxError: Can not use 'await' as identifier inside a static block (7:28)", + "SyntaxError: Can not use 'await' as identifier inside a static block (9:31)", "SyntaxError: Can not use 'await' as identifier inside a static block (11:28)", - "SyntaxError: Can not use 'await' as identifier inside a static block (13:28)", - "SyntaxError: Can not use 'await' as identifier inside a static block (15:25)", - "SyntaxError: Can not use 'await' as identifier inside a static block (17:25)", - "SyntaxError: Can not use 'await' as identifier inside a static block (19:31)", - "SyntaxError: Can not use 'await' as identifier inside a static block (21:31)", - "SyntaxError: Can not use 'await' as identifier inside a static block (23:28)", - "SyntaxError: Can not use 'await' as identifier inside a static block (25:30)", - "SyntaxError: Can not use 'await' as identifier inside a static block (27:21)" + "SyntaxError: Can not use 'await' as identifier inside a static block (13:21)", + "SyntaxError: Can not use 'await' as identifier inside a static block (15:32)" ], "program": { "type": "Program", - "start":0,"end":568,"loc":{"start":{"line":1,"column":0},"end":{"line":27,"column":34}}, + "start":0,"end":294,"loc":{"start":{"line":1,"column":0},"end":{"line":15,"column":45}}, "sourceType": "script", "interpreter": null, "body": [ @@ -82,10 +76,10 @@ }, { "type": "ExpressionStatement", - "start":41,"end":78,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":37}}, + "start":41,"end":74,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":33}}, "expression": { "type": "AssignmentExpression", - "start":41,"end":77,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":36}}, + "start":41,"end":73,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":32}}, "operator": "=", "left": { "type": "Identifier", @@ -94,131 +88,26 @@ }, "right": { "type": "ClassExpression", - "start":45,"end":77,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":36}}, + "start":45,"end":73,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":32}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start":51,"end":77,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":36}}, + "start":51,"end":73,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":32}}, "body": [ { "type": "StaticBlock", - "start":53,"end":75,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":34}}, + "start":53,"end":71,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":30}}, "body": [ { "type": "ExpressionStatement", - "start":62,"end":73,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":32}}, - "expression": { - "type": "ArrowFunctionExpression", - "start":62,"end":73,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":32}}, - "id": null, - "generator": false, - "async": false, - "params": [], - "body": { - "type": "Identifier", - "start":68,"end":73,"loc":{"start":{"line":5,"column":27},"end":{"line":5,"column":32},"identifierName":"await"}, - "name": "await" - } - } - } - ] - } - ] - } - } - } - }, - { - "type": "ExpressionStatement", - "start":80,"end":119,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":39}}, - "expression": { - "type": "AssignmentExpression", - "start":80,"end":118,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":38}}, - "operator": "=", - "left": { - "type": "Identifier", - "start":80,"end":81,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":1},"identifierName":"C"}, - "name": "C" - }, - "right": { - "type": "ClassExpression", - "start":84,"end":118,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":38}}, - "id": null, - "superClass": null, - "body": { - "type": "ClassBody", - "start":90,"end":118,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":38}}, - "body": [ - { - "type": "StaticBlock", - "start":92,"end":116,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":36}}, - "body": [ - { - "type": "ExpressionStatement", - "start":101,"end":114,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":34}}, - "expression": { - "type": "ArrowFunctionExpression", - "start":101,"end":114,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":34}}, - "id": null, - "generator": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start":102,"end":107,"loc":{"start":{"line":7,"column":22},"end":{"line":7,"column":27},"identifierName":"await"}, - "name": "await" - } - ], - "body": { - "type": "BlockStatement", - "start":112,"end":114,"loc":{"start":{"line":7,"column":32},"end":{"line":7,"column":34}}, - "body": [], - "directives": [] - } - } - } - ] - } - ] - } - } - } - }, - { - "type": "ExpressionStatement", - "start":121,"end":154,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":33}}, - "expression": { - "type": "AssignmentExpression", - "start":121,"end":153,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":32}}, - "operator": "=", - "left": { - "type": "Identifier", - "start":121,"end":122,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":1},"identifierName":"C"}, - "name": "C" - }, - "right": { - "type": "ClassExpression", - "start":125,"end":153,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":32}}, - "id": null, - "superClass": null, - "body": { - "type": "ClassBody", - "start":131,"end":153,"loc":{"start":{"line":9,"column":10},"end":{"line":9,"column":32}}, - "body": [ - { - "type": "StaticBlock", - "start":133,"end":151,"loc":{"start":{"line":9,"column":12},"end":{"line":9,"column":30}}, - "body": [ - { - "type": "ExpressionStatement", - "start":142,"end":149,"loc":{"start":{"line":9,"column":21},"end":{"line":9,"column":28}}, + "start":62,"end":69,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":28}}, "expression": { "type": "Identifier", - "start":143,"end":148,"loc":{"start":{"line":9,"column":22},"end":{"line":9,"column":27},"identifierName":"await"}, + "start":63,"end":68,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":27},"identifierName":"await"}, "extra": { "parenthesized": true, - "parenStart": 142 + "parenStart": 62 }, "name": "await" } @@ -232,100 +121,44 @@ }, { "type": "ExpressionStatement", - "start":156,"end":201,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":45}}, + "start":76,"end":115,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":39}}, "expression": { "type": "AssignmentExpression", - "start":156,"end":200,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":44}}, + "start":76,"end":114,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":38}}, "operator": "=", "left": { "type": "Identifier", - "start":156,"end":157,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":1},"identifierName":"C"}, + "start":76,"end":77,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":1},"identifierName":"C"}, "name": "C" }, "right": { "type": "ClassExpression", - "start":160,"end":200,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":44}}, + "start":80,"end":114,"loc":{"start":{"line":7,"column":4},"end":{"line":7,"column":38}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start":166,"end":200,"loc":{"start":{"line":11,"column":10},"end":{"line":11,"column":44}}, + "start":86,"end":114,"loc":{"start":{"line":7,"column":10},"end":{"line":7,"column":38}}, "body": [ { "type": "StaticBlock", - "start":168,"end":198,"loc":{"start":{"line":11,"column":12},"end":{"line":11,"column":42}}, + "start":88,"end":112,"loc":{"start":{"line":7,"column":12},"end":{"line":7,"column":36}}, "body": [ { "type": "ExpressionStatement", - "start":177,"end":196,"loc":{"start":{"line":11,"column":21},"end":{"line":11,"column":40}}, - "expression": { - "type": "ArrowFunctionExpression", - "start":177,"end":196,"loc":{"start":{"line":11,"column":21},"end":{"line":11,"column":40}}, - "id": null, - "generator": false, - "async": true, - "params": [ - { - "type": "Identifier", - "start":184,"end":189,"loc":{"start":{"line":11,"column":28},"end":{"line":11,"column":33},"identifierName":"await"}, - "name": "await" - } - ], - "body": { - "type": "BlockStatement", - "start":194,"end":196,"loc":{"start":{"line":11,"column":38},"end":{"line":11,"column":40}}, - "body": [], - "directives": [] - } - } - } - ] - } - ] - } - } - } - }, - { - "type": "ExpressionStatement", - "start":203,"end":242,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":39}}, - "expression": { - "type": "AssignmentExpression", - "start":203,"end":241,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":38}}, - "operator": "=", - "left": { - "type": "Identifier", - "start":203,"end":204,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":1},"identifierName":"C"}, - "name": "C" - }, - "right": { - "type": "ClassExpression", - "start":207,"end":241,"loc":{"start":{"line":13,"column":4},"end":{"line":13,"column":38}}, - "id": null, - "superClass": null, - "body": { - "type": "ClassBody", - "start":213,"end":241,"loc":{"start":{"line":13,"column":10},"end":{"line":13,"column":38}}, - "body": [ - { - "type": "StaticBlock", - "start":215,"end":239,"loc":{"start":{"line":13,"column":12},"end":{"line":13,"column":36}}, - "body": [ - { - "type": "ExpressionStatement", - "start":224,"end":237,"loc":{"start":{"line":13,"column":21},"end":{"line":13,"column":34}}, + "start":97,"end":110,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":34}}, "expression": { "type": "CallExpression", - "start":224,"end":237,"loc":{"start":{"line":13,"column":21},"end":{"line":13,"column":34}}, + "start":97,"end":110,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":34}}, "callee": { "type": "Identifier", - "start":224,"end":229,"loc":{"start":{"line":13,"column":21},"end":{"line":13,"column":26},"identifierName":"async"}, + "start":97,"end":102,"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":26},"identifierName":"async"}, "name": "async" }, "arguments": [ { "type": "Identifier", - "start":231,"end":236,"loc":{"start":{"line":13,"column":28},"end":{"line":13,"column":33},"identifierName":"await"}, + "start":104,"end":109,"loc":{"start":{"line":7,"column":28},"end":{"line":7,"column":33},"identifierName":"await"}, "name": "await" } ] @@ -340,270 +173,59 @@ }, { "type": "ExpressionStatement", - "start":244,"end":291,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":47}}, + "start":117,"end":164,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":47}}, "expression": { "type": "AssignmentExpression", - "start":244,"end":290,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":46}}, + "start":117,"end":163,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":46}}, "operator": "=", "left": { "type": "Identifier", - "start":244,"end":245,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":1},"identifierName":"C"}, + "start":117,"end":118,"loc":{"start":{"line":9,"column":0},"end":{"line":9,"column":1},"identifierName":"C"}, "name": "C" }, "right": { "type": "ClassExpression", - "start":248,"end":290,"loc":{"start":{"line":15,"column":4},"end":{"line":15,"column":46}}, + "start":121,"end":163,"loc":{"start":{"line":9,"column":4},"end":{"line":9,"column":46}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start":254,"end":290,"loc":{"start":{"line":15,"column":10},"end":{"line":15,"column":46}}, + "start":127,"end":163,"loc":{"start":{"line":9,"column":10},"end":{"line":9,"column":46}}, "body": [ { "type": "StaticBlock", - "start":256,"end":288,"loc":{"start":{"line":15,"column":12},"end":{"line":15,"column":44}}, + "start":129,"end":161,"loc":{"start":{"line":9,"column":12},"end":{"line":9,"column":44}}, "body": [ { "type": "ExpressionStatement", - "start":265,"end":286,"loc":{"start":{"line":15,"column":21},"end":{"line":15,"column":42}}, - "expression": { - "type": "ArrowFunctionExpression", - "start":265,"end":286,"loc":{"start":{"line":15,"column":21},"end":{"line":15,"column":42}}, - "id": null, - "generator": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "start":266,"end":279,"loc":{"start":{"line":15,"column":22},"end":{"line":15,"column":35}}, - "properties": [ - { - "type": "ObjectProperty", - "start":268,"end":278,"loc":{"start":{"line":15,"column":24},"end":{"line":15,"column":34}}, - "method": false, - "computed": true, - "key": { - "type": "Identifier", - "start":269,"end":274,"loc":{"start":{"line":15,"column":25},"end":{"line":15,"column":30},"identifierName":"await"}, - "name": "await" - }, - "shorthand": false, - "value": { - "type": "Identifier", - "start":277,"end":278,"loc":{"start":{"line":15,"column":33},"end":{"line":15,"column":34},"identifierName":"x"}, - "name": "x" - } - } - ] - } - ], - "body": { - "type": "BlockStatement", - "start":284,"end":286,"loc":{"start":{"line":15,"column":40},"end":{"line":15,"column":42}}, - "body": [], - "directives": [] - } - } - } - ] - } - ] - } - } - } - }, - { - "type": "ExpressionStatement", - "start":293,"end":334,"loc":{"start":{"line":17,"column":0},"end":{"line":17,"column":41}}, - "expression": { - "type": "AssignmentExpression", - "start":293,"end":333,"loc":{"start":{"line":17,"column":0},"end":{"line":17,"column":40}}, - "operator": "=", - "left": { - "type": "Identifier", - "start":293,"end":294,"loc":{"start":{"line":17,"column":0},"end":{"line":17,"column":1},"identifierName":"C"}, - "name": "C" - }, - "right": { - "type": "ClassExpression", - "start":297,"end":333,"loc":{"start":{"line":17,"column":4},"end":{"line":17,"column":40}}, - "id": null, - "superClass": null, - "body": { - "type": "ClassBody", - "start":303,"end":333,"loc":{"start":{"line":17,"column":10},"end":{"line":17,"column":40}}, - "body": [ - { - "type": "StaticBlock", - "start":305,"end":331,"loc":{"start":{"line":17,"column":12},"end":{"line":17,"column":38}}, - "body": [ - { - "type": "ExpressionStatement", - "start":314,"end":329,"loc":{"start":{"line":17,"column":21},"end":{"line":17,"column":36}}, - "expression": { - "type": "ObjectExpression", - "start":315,"end":328,"loc":{"start":{"line":17,"column":22},"end":{"line":17,"column":35}}, - "extra": { - "parenthesized": true, - "parenStart": 314 - }, - "properties": [ - { - "type": "ObjectProperty", - "start":317,"end":327,"loc":{"start":{"line":17,"column":24},"end":{"line":17,"column":34}}, - "method": false, - "computed": true, - "key": { - "type": "Identifier", - "start":318,"end":323,"loc":{"start":{"line":17,"column":25},"end":{"line":17,"column":30},"identifierName":"await"}, - "name": "await" - }, - "shorthand": false, - "value": { - "type": "Identifier", - "start":326,"end":327,"loc":{"start":{"line":17,"column":33},"end":{"line":17,"column":34},"identifierName":"x"}, - "name": "x" - } - } - ] - } - } - ] - } - ] - } - } - } - }, - { - "type": "ExpressionStatement", - "start":336,"end":389,"loc":{"start":{"line":19,"column":0},"end":{"line":19,"column":53}}, - "expression": { - "type": "AssignmentExpression", - "start":336,"end":388,"loc":{"start":{"line":19,"column":0},"end":{"line":19,"column":52}}, - "operator": "=", - "left": { - "type": "Identifier", - "start":336,"end":337,"loc":{"start":{"line":19,"column":0},"end":{"line":19,"column":1},"identifierName":"C"}, - "name": "C" - }, - "right": { - "type": "ClassExpression", - "start":340,"end":388,"loc":{"start":{"line":19,"column":4},"end":{"line":19,"column":52}}, - "id": null, - "superClass": null, - "body": { - "type": "ClassBody", - "start":346,"end":388,"loc":{"start":{"line":19,"column":10},"end":{"line":19,"column":52}}, - "body": [ - { - "type": "StaticBlock", - "start":348,"end":386,"loc":{"start":{"line":19,"column":12},"end":{"line":19,"column":50}}, - "body": [ - { - "type": "ExpressionStatement", - "start":357,"end":384,"loc":{"start":{"line":19,"column":21},"end":{"line":19,"column":48}}, - "expression": { - "type": "ArrowFunctionExpression", - "start":357,"end":384,"loc":{"start":{"line":19,"column":21},"end":{"line":19,"column":48}}, - "id": null, - "generator": false, - "async": true, - "params": [ - { - "type": "ObjectPattern", - "start":364,"end":377,"loc":{"start":{"line":19,"column":28},"end":{"line":19,"column":41}}, - "properties": [ - { - "type": "ObjectProperty", - "start":366,"end":376,"loc":{"start":{"line":19,"column":30},"end":{"line":19,"column":40}}, - "method": false, - "computed": true, - "key": { - "type": "Identifier", - "start":367,"end":372,"loc":{"start":{"line":19,"column":31},"end":{"line":19,"column":36},"identifierName":"await"}, - "name": "await" - }, - "shorthand": false, - "value": { - "type": "Identifier", - "start":375,"end":376,"loc":{"start":{"line":19,"column":39},"end":{"line":19,"column":40},"identifierName":"x"}, - "name": "x" - } - } - ] - } - ], - "body": { - "type": "BlockStatement", - "start":382,"end":384,"loc":{"start":{"line":19,"column":46},"end":{"line":19,"column":48}}, - "body": [], - "directives": [] - } - } - } - ] - } - ] - } - } - } - }, - { - "type": "ExpressionStatement", - "start":391,"end":438,"loc":{"start":{"line":21,"column":0},"end":{"line":21,"column":47}}, - "expression": { - "type": "AssignmentExpression", - "start":391,"end":437,"loc":{"start":{"line":21,"column":0},"end":{"line":21,"column":46}}, - "operator": "=", - "left": { - "type": "Identifier", - "start":391,"end":392,"loc":{"start":{"line":21,"column":0},"end":{"line":21,"column":1},"identifierName":"C"}, - "name": "C" - }, - "right": { - "type": "ClassExpression", - "start":395,"end":437,"loc":{"start":{"line":21,"column":4},"end":{"line":21,"column":46}}, - "id": null, - "superClass": null, - "body": { - "type": "ClassBody", - "start":401,"end":437,"loc":{"start":{"line":21,"column":10},"end":{"line":21,"column":46}}, - "body": [ - { - "type": "StaticBlock", - "start":403,"end":435,"loc":{"start":{"line":21,"column":12},"end":{"line":21,"column":44}}, - "body": [ - { - "type": "ExpressionStatement", - "start":412,"end":433,"loc":{"start":{"line":21,"column":21},"end":{"line":21,"column":42}}, + "start":138,"end":159,"loc":{"start":{"line":9,"column":21},"end":{"line":9,"column":42}}, "expression": { "type": "CallExpression", - "start":412,"end":433,"loc":{"start":{"line":21,"column":21},"end":{"line":21,"column":42}}, + "start":138,"end":159,"loc":{"start":{"line":9,"column":21},"end":{"line":9,"column":42}}, "callee": { "type": "Identifier", - "start":412,"end":417,"loc":{"start":{"line":21,"column":21},"end":{"line":21,"column":26},"identifierName":"async"}, + "start":138,"end":143,"loc":{"start":{"line":9,"column":21},"end":{"line":9,"column":26},"identifierName":"async"}, "name": "async" }, "arguments": [ { "type": "ObjectExpression", - "start":419,"end":432,"loc":{"start":{"line":21,"column":28},"end":{"line":21,"column":41}}, + "start":145,"end":158,"loc":{"start":{"line":9,"column":28},"end":{"line":9,"column":41}}, "properties": [ { "type": "ObjectProperty", - "start":421,"end":431,"loc":{"start":{"line":21,"column":30},"end":{"line":21,"column":40}}, + "start":147,"end":157,"loc":{"start":{"line":9,"column":30},"end":{"line":9,"column":40}}, "method": false, "computed": true, "key": { "type": "Identifier", - "start":422,"end":427,"loc":{"start":{"line":21,"column":31},"end":{"line":21,"column":36},"identifierName":"await"}, + "start":148,"end":153,"loc":{"start":{"line":9,"column":31},"end":{"line":9,"column":36},"identifierName":"await"}, "name": "await" }, "shorthand": false, "value": { "type": "Identifier", - "start":430,"end":431,"loc":{"start":{"line":21,"column":39},"end":{"line":21,"column":40},"identifierName":"x"}, + "start":156,"end":157,"loc":{"start":{"line":9,"column":39},"end":{"line":9,"column":40},"identifierName":"x"}, "name": "x" } } @@ -621,41 +243,41 @@ }, { "type": "ExpressionStatement", - "start":440,"end":485,"loc":{"start":{"line":23,"column":0},"end":{"line":23,"column":45}}, + "start":166,"end":211,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":45}}, "expression": { "type": "ArrowFunctionExpression", - "start":440,"end":484,"loc":{"start":{"line":23,"column":0},"end":{"line":23,"column":44}}, + "start":166,"end":210,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":44}}, "id": null, "generator": false, "async": true, "params": [ { "type": "AssignmentPattern", - "start":447,"end":477,"loc":{"start":{"line":23,"column":7},"end":{"line":23,"column":37}}, + "start":173,"end":203,"loc":{"start":{"line":11,"column":7},"end":{"line":11,"column":37}}, "left": { "type": "Identifier", - "start":447,"end":448,"loc":{"start":{"line":23,"column":7},"end":{"line":23,"column":8},"identifierName":"x"}, + "start":173,"end":174,"loc":{"start":{"line":11,"column":7},"end":{"line":11,"column":8},"identifierName":"x"}, "name": "x" }, "right": { "type": "ClassExpression", - "start":451,"end":477,"loc":{"start":{"line":23,"column":11},"end":{"line":23,"column":37}}, + "start":177,"end":203,"loc":{"start":{"line":11,"column":11},"end":{"line":11,"column":37}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start":457,"end":477,"loc":{"start":{"line":23,"column":17},"end":{"line":23,"column":37}}, + "start":183,"end":203,"loc":{"start":{"line":11,"column":17},"end":{"line":11,"column":37}}, "body": [ { "type": "StaticBlock", - "start":459,"end":475,"loc":{"start":{"line":23,"column":19},"end":{"line":23,"column":35}}, + "start":185,"end":201,"loc":{"start":{"line":11,"column":19},"end":{"line":11,"column":35}}, "body": [ { "type": "ExpressionStatement", - "start":468,"end":473,"loc":{"start":{"line":23,"column":28},"end":{"line":23,"column":33}}, + "start":194,"end":199,"loc":{"start":{"line":11,"column":28},"end":{"line":11,"column":33}}, "expression": { "type": "Identifier", - "start":468,"end":473,"loc":{"start":{"line":23,"column":28},"end":{"line":23,"column":33},"identifierName":"await"}, + "start":194,"end":199,"loc":{"start":{"line":11,"column":28},"end":{"line":11,"column":33},"identifierName":"await"}, "name": "await" } } @@ -668,7 +290,7 @@ ], "body": { "type": "BlockStatement", - "start":482,"end":484,"loc":{"start":{"line":23,"column":42},"end":{"line":23,"column":44}}, + "start":208,"end":210,"loc":{"start":{"line":11,"column":42},"end":{"line":11,"column":44}}, "body": [], "directives": [] } @@ -676,45 +298,49 @@ }, { "type": "ExpressionStatement", - "start":487,"end":532,"loc":{"start":{"line":25,"column":0},"end":{"line":25,"column":45}}, + "start":213,"end":247,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":34}}, "expression": { "type": "AssignmentExpression", - "start":487,"end":531,"loc":{"start":{"line":25,"column":0},"end":{"line":25,"column":44}}, + "start":213,"end":246,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":33}}, "operator": "=", "left": { "type": "Identifier", - "start":487,"end":488,"loc":{"start":{"line":25,"column":0},"end":{"line":25,"column":1},"identifierName":"C"}, + "start":213,"end":214,"loc":{"start":{"line":13,"column":0},"end":{"line":13,"column":1},"identifierName":"C"}, "name": "C" }, "right": { "type": "ClassExpression", - "start":491,"end":531,"loc":{"start":{"line":25,"column":4},"end":{"line":25,"column":44}}, + "start":217,"end":246,"loc":{"start":{"line":13,"column":4},"end":{"line":13,"column":33}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start":497,"end":531,"loc":{"start":{"line":25,"column":10},"end":{"line":25,"column":44}}, + "start":223,"end":246,"loc":{"start":{"line":13,"column":10},"end":{"line":13,"column":33}}, "body": [ { "type": "StaticBlock", - "start":499,"end":529,"loc":{"start":{"line":25,"column":12},"end":{"line":25,"column":42}}, + "start":225,"end":244,"loc":{"start":{"line":13,"column":12},"end":{"line":13,"column":31}}, "body": [ { - "type": "FunctionDeclaration", - "start":508,"end":527,"loc":{"start":{"line":25,"column":21},"end":{"line":25,"column":40}}, - "id": { + "type": "LabeledStatement", + "start":234,"end":242,"loc":{"start":{"line":13,"column":21},"end":{"line":13,"column":29}}, + "body": { + "type": "ExpressionStatement", + "start":241,"end":242,"loc":{"start":{"line":13,"column":28},"end":{"line":13,"column":29}}, + "expression": { + "type": "NumericLiteral", + "start":241,"end":242,"loc":{"start":{"line":13,"column":28},"end":{"line":13,"column":29}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "label": { "type": "Identifier", - "start":517,"end":522,"loc":{"start":{"line":25,"column":30},"end":{"line":25,"column":35},"identifierName":"await"}, + "start":234,"end":239,"loc":{"start":{"line":13,"column":21},"end":{"line":13,"column":26},"identifierName":"await"}, "name": "await" - }, - "generator": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start":525,"end":527,"loc":{"start":{"line":25,"column":38},"end":{"line":25,"column":40}}, - "body": [], - "directives": [] } } ] @@ -726,49 +352,55 @@ }, { "type": "ExpressionStatement", - "start":534,"end":568,"loc":{"start":{"line":27,"column":0},"end":{"line":27,"column":34}}, + "start":249,"end":294,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":45}}, "expression": { "type": "AssignmentExpression", - "start":534,"end":567,"loc":{"start":{"line":27,"column":0},"end":{"line":27,"column":33}}, + "start":249,"end":293,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":44}}, "operator": "=", "left": { "type": "Identifier", - "start":534,"end":535,"loc":{"start":{"line":27,"column":0},"end":{"line":27,"column":1},"identifierName":"C"}, + "start":249,"end":250,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":1},"identifierName":"C"}, "name": "C" }, "right": { "type": "ClassExpression", - "start":538,"end":567,"loc":{"start":{"line":27,"column":4},"end":{"line":27,"column":33}}, + "start":253,"end":293,"loc":{"start":{"line":15,"column":4},"end":{"line":15,"column":44}}, "id": null, "superClass": null, "body": { "type": "ClassBody", - "start":544,"end":567,"loc":{"start":{"line":27,"column":10},"end":{"line":27,"column":33}}, + "start":259,"end":293,"loc":{"start":{"line":15,"column":10},"end":{"line":15,"column":44}}, "body": [ { "type": "StaticBlock", - "start":546,"end":565,"loc":{"start":{"line":27,"column":12},"end":{"line":27,"column":31}}, + "start":261,"end":291,"loc":{"start":{"line":15,"column":12},"end":{"line":15,"column":42}}, "body": [ { - "type": "LabeledStatement", - "start":555,"end":563,"loc":{"start":{"line":27,"column":21},"end":{"line":27,"column":29}}, - "body": { - "type": "ExpressionStatement", - "start":562,"end":563,"loc":{"start":{"line":27,"column":28},"end":{"line":27,"column":29}}, - "expression": { - "type": "NumericLiteral", - "start":562,"end":563,"loc":{"start":{"line":27,"column":28},"end":{"line":27,"column":29}}, - "extra": { - "rawValue": 0, - "raw": "0" - }, - "value": 0 - } - }, - "label": { + "type": "ClassDeclaration", + "start":270,"end":289,"loc":{"start":{"line":15,"column":21},"end":{"line":15,"column":40}}, + "id": { "type": "Identifier", - "start":555,"end":560,"loc":{"start":{"line":27,"column":21},"end":{"line":27,"column":26},"identifierName":"await"}, - "name": "await" + "start":276,"end":277,"loc":{"start":{"line":15,"column":27},"end":{"line":15,"column":28},"identifierName":"D"}, + "name": "D" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":278,"end":289,"loc":{"start":{"line":15,"column":29},"end":{"line":15,"column":40}}, + "body": [ + { + "type": "ClassProperty", + "start":280,"end":287,"loc":{"start":{"line":15,"column":31},"end":{"line":15,"column":38}}, + "static": false, + "computed": true, + "key": { + "type": "Identifier", + "start":281,"end":286,"loc":{"start":{"line":15,"column":32},"end":{"line":15,"column":37},"identifierName":"await"}, + "name": "await" + }, + "value": null + } + ] } } ]