From a5a938092ab73b354cebde1818030f0ca6680256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 31 Jan 2023 20:03:29 -0500 Subject: [PATCH] add more test cases --- .../invalid-using-binding-await/input.js | 3 ++ .../invalid-using-binding-await/output.json | 50 +++++++++++++++++-- 2 files changed, 50 insertions(+), 3 deletions(-) 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..8a5bc8f65ca3 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,6 @@ { using \u0061wait = h(); } +{ + using x, await = h(); +} 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..b8d7e60dcc96 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,14 @@ { "type": "File", - "start":0,"end":54,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":6,"column":1,"index":54}}, + "start":0,"end":82,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":9,"column":1,"index":82}}, "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)" ], "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":82,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":9,"column":1,"index":82}}, "sourceType": "script", "interpreter": null, "body": [ @@ -76,6 +77,49 @@ } ], "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": [] } ], "directives": []