diff --git a/packages/babel-parser/test/fixtures/experimental/explicit-resource-management/invalid-using-binding-await/input.js b/packages/babel-parser/test/fixtures/experimental/explicit-resource-management/invalid-using-binding-await/input.js index 46ba5c6677af..9eb1bacb90b0 100644 --- a/packages/babel-parser/test/fixtures/experimental/explicit-resource-management/invalid-using-binding-await/input.js +++ b/packages/babel-parser/test/fixtures/experimental/explicit-resource-management/invalid-using-binding-await/input.js @@ -4,3 +4,9 @@ { using \u0061wait = h(); } +{ + using x, await = h(); +} +{ + for (using await of []); +} diff --git a/packages/babel-parser/test/fixtures/experimental/explicit-resource-management/invalid-using-binding-await/output.json b/packages/babel-parser/test/fixtures/experimental/explicit-resource-management/invalid-using-binding-await/output.json index 9e2e5614057c..5f57e6c4814c 100644 --- a/packages/babel-parser/test/fixtures/experimental/explicit-resource-management/invalid-using-binding-await/output.json +++ b/packages/babel-parser/test/fixtures/experimental/explicit-resource-management/invalid-using-binding-await/output.json @@ -1,13 +1,15 @@ { "type": "File", - "start":0,"end":54,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":6,"column":1,"index":54}}, + "start":0,"end":113,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":12,"column":1,"index":113}}, "errors": [ "SyntaxError: 'await' is not allowed to be used as a name in 'using' declarations. (2:8)", - "SyntaxError: 'await' is not allowed to be used as a name in 'using' declarations. (5:8)" + "SyntaxError: 'await' is not allowed to be used as a name in 'using' declarations. (5:8)", + "SyntaxError: 'await' is not allowed to be used as a name in 'using' declarations. (8:11)", + "SyntaxError: 'await' is not allowed to be used as a name in 'using' declarations. (11:13)" ], "program": { "type": "Program", - "start":0,"end":54,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":6,"column":1,"index":54}}, + "start":0,"end":113,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":12,"column":1,"index":113}}, "sourceType": "script", "interpreter": null, "body": [ @@ -76,6 +78,87 @@ } ], "directives": [] + }, + { + "type": "BlockStatement", + "start":55,"end":82,"loc":{"start":{"line":7,"column":0,"index":55},"end":{"line":9,"column":1,"index":82}}, + "body": [ + { + "type": "VariableDeclaration", + "start":59,"end":80,"loc":{"start":{"line":8,"column":2,"index":59},"end":{"line":8,"column":23,"index":80}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":65,"end":66,"loc":{"start":{"line":8,"column":8,"index":65},"end":{"line":8,"column":9,"index":66}}, + "id": { + "type": "Identifier", + "start":65,"end":66,"loc":{"start":{"line":8,"column":8,"index":65},"end":{"line":8,"column":9,"index":66},"identifierName":"x"}, + "name": "x" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "start":68,"end":79,"loc":{"start":{"line":8,"column":11,"index":68},"end":{"line":8,"column":22,"index":79}}, + "id": { + "type": "Identifier", + "start":68,"end":73,"loc":{"start":{"line":8,"column":11,"index":68},"end":{"line":8,"column":16,"index":73},"identifierName":"await"}, + "name": "await" + }, + "init": { + "type": "CallExpression", + "start":76,"end":79,"loc":{"start":{"line":8,"column":19,"index":76},"end":{"line":8,"column":22,"index":79}}, + "callee": { + "type": "Identifier", + "start":76,"end":77,"loc":{"start":{"line":8,"column":19,"index":76},"end":{"line":8,"column":20,"index":77},"identifierName":"h"}, + "name": "h" + }, + "arguments": [] + } + } + ], + "kind": "using" + } + ], + "directives": [] + }, + { + "type": "BlockStatement", + "start":83,"end":113,"loc":{"start":{"line":10,"column":0,"index":83},"end":{"line":12,"column":1,"index":113}}, + "body": [ + { + "type": "ForOfStatement", + "start":87,"end":111,"loc":{"start":{"line":11,"column":2,"index":87},"end":{"line":11,"column":26,"index":111}}, + "await": false, + "left": { + "type": "VariableDeclaration", + "start":92,"end":103,"loc":{"start":{"line":11,"column":7,"index":92},"end":{"line":11,"column":18,"index":103}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":98,"end":103,"loc":{"start":{"line":11,"column":13,"index":98},"end":{"line":11,"column":18,"index":103}}, + "id": { + "type": "Identifier", + "start":98,"end":103,"loc":{"start":{"line":11,"column":13,"index":98},"end":{"line":11,"column":18,"index":103},"identifierName":"await"}, + "name": "await" + }, + "init": null + } + ], + "kind": "using" + }, + "right": { + "type": "ArrayExpression", + "start":107,"end":109,"loc":{"start":{"line":11,"column":22,"index":107},"end":{"line":11,"column":24,"index":109}}, + "elements": [] + }, + "body": { + "type": "EmptyStatement", + "start":110,"end":111,"loc":{"start":{"line":11,"column":25,"index":110},"end":{"line":11,"column":26,"index":111}} + } + } + ], + "directives": [] } ], "directives": []