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 da689d0c73eb..8468c2f86fdd 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 @@ -59,7 +59,6 @@ }, "generator": false, "async": false, - "expression": false, "params": [], "body": { "type": "BlockStatement", @@ -74,7 +73,8 @@ "name": "await" } } - ] + ], + "directives": [] } } ] @@ -119,7 +119,6 @@ }, "generator": false, "async": false, - "expression": false, "params": [ { "type": "Identifier", @@ -130,7 +129,8 @@ "body": { "type": "BlockStatement", "start":97,"end":99,"loc":{"start":{"line":5,"column":39},"end":{"line":5,"column":41}}, - "body": [] + "body": [], + "directives": [] } } ] @@ -175,7 +175,6 @@ }, "generator": false, "async": false, - "expression": false, "params": [ { "type": "AssignmentPattern", @@ -195,7 +194,8 @@ "body": { "type": "BlockStatement", "start":149,"end":151,"loc":{"start":{"line":7,"column":43},"end":{"line":7,"column":45}}, - "body": [] + "body": [], + "directives": [] } } ] @@ -240,14 +240,13 @@ }, "generator": false, "async": false, - "expression": false, "params": [ { "type": "ObjectPattern", "start":190,"end":204,"loc":{"start":{"line":9,"column":32},"end":{"line":9,"column":46}}, "properties": [ { - "type": "Property", + "type": "ObjectProperty", "start":192,"end":202,"loc":{"start":{"line":9,"column":34},"end":{"line":9,"column":44}}, "method": false, "computed": true, @@ -261,8 +260,7 @@ "type": "Identifier", "start":201,"end":202,"loc":{"start":{"line":9,"column":43},"end":{"line":9,"column":44},"identifierName":"x"}, "name": "x" - }, - "kind": "init" + } } ] } @@ -270,7 +268,8 @@ "body": { "type": "BlockStatement", "start":206,"end":208,"loc":{"start":{"line":9,"column":48},"end":{"line":9,"column":50}}, - "body": [] + "body": [], + "directives": [] } } ] @@ -280,6 +279,7 @@ } } } - ] + ], + "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 c23689913ca4..1813534f9131 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 @@ -21,3 +21,7 @@ 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 } }; 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 19bbde57a4c3..c3fb984ad5a4 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,6 +1,6 @@ { "type": "File", - "start":0,"end":485,"loc":{"start":{"line":1,"column":0},"end":{"line":23,"column":45}}, + "start":0,"end":568,"loc":{"start":{"line":1,"column":0},"end":{"line":27,"column":34}}, "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)", @@ -12,11 +12,13 @@ "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 (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)" ], "program": { "type": "Program", - "start":0,"end":485,"loc":{"start":{"line":1,"column":0},"end":{"line":23,"column":45}}, + "start":0,"end":568,"loc":{"start":{"line":1,"column":0},"end":{"line":27,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ @@ -671,8 +673,112 @@ "directives": [] } } + }, + { + "type": "ExpressionStatement", + "start":487,"end":532,"loc":{"start":{"line":25,"column":0},"end":{"line":25,"column":45}}, + "expression": { + "type": "AssignmentExpression", + "start":487,"end":531,"loc":{"start":{"line":25,"column":0},"end":{"line":25,"column":44}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":487,"end":488,"loc":{"start":{"line":25,"column":0},"end":{"line":25,"column":1},"identifierName":"C"}, + "name": "C" + }, + "right": { + "type": "ClassExpression", + "start":491,"end":531,"loc":{"start":{"line":25,"column":4},"end":{"line":25,"column":44}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":497,"end":531,"loc":{"start":{"line":25,"column":10},"end":{"line":25,"column":44}}, + "body": [ + { + "type": "StaticBlock", + "start":499,"end":529,"loc":{"start":{"line":25,"column":12},"end":{"line":25,"column":42}}, + "body": [ + { + "type": "FunctionDeclaration", + "start":508,"end":527,"loc":{"start":{"line":25,"column":21},"end":{"line":25,"column":40}}, + "id": { + "type": "Identifier", + "start":517,"end":522,"loc":{"start":{"line":25,"column":30},"end":{"line":25,"column":35},"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": [] + } + } + ] + } + ] + } + } + } + }, + { + "type": "ExpressionStatement", + "start":534,"end":568,"loc":{"start":{"line":27,"column":0},"end":{"line":27,"column":34}}, + "expression": { + "type": "AssignmentExpression", + "start":534,"end":567,"loc":{"start":{"line":27,"column":0},"end":{"line":27,"column":33}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":534,"end":535,"loc":{"start":{"line":27,"column":0},"end":{"line":27,"column":1},"identifierName":"C"}, + "name": "C" + }, + "right": { + "type": "ClassExpression", + "start":538,"end":567,"loc":{"start":{"line":27,"column":4},"end":{"line":27,"column":33}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":544,"end":567,"loc":{"start":{"line":27,"column":10},"end":{"line":27,"column":33}}, + "body": [ + { + "type": "StaticBlock", + "start":546,"end":565,"loc":{"start":{"line":27,"column":12},"end":{"line":27,"column":31}}, + "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": "Identifier", + "start":555,"end":560,"loc":{"start":{"line":27,"column":21},"end":{"line":27,"column":26},"identifierName":"await"}, + "name": "await" + } + } + ] + } + ] + } + } + } } ], "directives": [] } -} +} \ No newline at end of file