From b7dd96667488b6cc830080f5aefd1ba4a0f01741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Sat, 29 Apr 2023 09:27:23 -0400 Subject: [PATCH] add new test cases --- .../valid-await-expr-using-in/input.js | 3 + .../valid-await-expr-using-in/output.json | 55 +++++++++++++++++++ .../input.js | 3 + .../output.json | 55 +++++++++++++++++++ .../valid-await-expr-using-in/input.js | 3 + .../valid-await-expr-using-in/output.json | 55 +++++++++++++++++++ .../input.js | 3 + .../output.json | 55 +++++++++++++++++++ 8 files changed, 232 insertions(+) create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-in/input.js create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-in/output.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-instanceof/input.js create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-instanceof/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-in/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-in/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-instanceof/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-instanceof/output.json diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-in/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-in/input.js new file mode 100644 index 000000000000..7dcf9e0239b2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-in/input.js @@ -0,0 +1,3 @@ +async function f() { + await using in foo; +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-in/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-in/output.json new file mode 100644 index 000000000000..17b6ddee31ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-in/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":44}}, + "program": { + "type": "Program", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":44}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":44}}, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15,"index":15},"end":{"line":1,"column":16,"index":16},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":44,"loc":{"start":{"line":1,"column":19,"index":19},"end":{"line":3,"column":1,"index":44}}, + "body": [ + { + "type": "ExpressionStatement", + "start":23,"end":42,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":21,"index":42}}, + "expression": { + "type": "BinaryExpression", + "start":23,"end":41,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":20,"index":41}}, + "left": { + "type": "AwaitExpression", + "start":23,"end":34,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":13,"index":34}}, + "argument": { + "type": "Identifier", + "start":29,"end":34,"loc":{"start":{"line":2,"column":8,"index":29},"end":{"line":2,"column":13,"index":34},"identifierName":"using"}, + "name": "using" + } + }, + "operator": "in", + "right": { + "type": "Identifier", + "start":38,"end":41,"loc":{"start":{"line":2,"column":17,"index":38},"end":{"line":2,"column":20,"index":41},"identifierName":"foo"}, + "name": "foo" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-instanceof/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-instanceof/input.js new file mode 100644 index 000000000000..1818647e4761 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-instanceof/input.js @@ -0,0 +1,3 @@ +async function f() { + await using instanceof foo; +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-instanceof/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-instanceof/output.json new file mode 100644 index 000000000000..39f78de56eb9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-instanceof/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":52}}, + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":52}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":52}}, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15,"index":15},"end":{"line":1,"column":16,"index":16},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":52,"loc":{"start":{"line":1,"column":19,"index":19},"end":{"line":3,"column":1,"index":52}}, + "body": [ + { + "type": "ExpressionStatement", + "start":23,"end":50,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":29,"index":50}}, + "expression": { + "type": "BinaryExpression", + "start":23,"end":49,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":28,"index":49}}, + "left": { + "type": "AwaitExpression", + "start":23,"end":34,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":13,"index":34}}, + "argument": { + "type": "Identifier", + "start":29,"end":34,"loc":{"start":{"line":2,"column":8,"index":29},"end":{"line":2,"column":13,"index":34},"identifierName":"using"}, + "name": "using" + } + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start":46,"end":49,"loc":{"start":{"line":2,"column":25,"index":46},"end":{"line":2,"column":28,"index":49},"identifierName":"foo"}, + "name": "foo" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-in/input.js b/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-in/input.js new file mode 100644 index 000000000000..7dcf9e0239b2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-in/input.js @@ -0,0 +1,3 @@ +async function f() { + await using in foo; +} diff --git a/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-in/output.json b/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-in/output.json new file mode 100644 index 000000000000..17b6ddee31ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-in/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":44}}, + "program": { + "type": "Program", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":44}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":44}}, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15,"index":15},"end":{"line":1,"column":16,"index":16},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":44,"loc":{"start":{"line":1,"column":19,"index":19},"end":{"line":3,"column":1,"index":44}}, + "body": [ + { + "type": "ExpressionStatement", + "start":23,"end":42,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":21,"index":42}}, + "expression": { + "type": "BinaryExpression", + "start":23,"end":41,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":20,"index":41}}, + "left": { + "type": "AwaitExpression", + "start":23,"end":34,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":13,"index":34}}, + "argument": { + "type": "Identifier", + "start":29,"end":34,"loc":{"start":{"line":2,"column":8,"index":29},"end":{"line":2,"column":13,"index":34},"identifierName":"using"}, + "name": "using" + } + }, + "operator": "in", + "right": { + "type": "Identifier", + "start":38,"end":41,"loc":{"start":{"line":2,"column":17,"index":38},"end":{"line":2,"column":20,"index":41},"identifierName":"foo"}, + "name": "foo" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-instanceof/input.js b/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-instanceof/input.js new file mode 100644 index 000000000000..1818647e4761 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-instanceof/input.js @@ -0,0 +1,3 @@ +async function f() { + await using instanceof foo; +} diff --git a/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-instanceof/output.json b/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-instanceof/output.json new file mode 100644 index 000000000000..39f78de56eb9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/async-explicit-resource-management/valid-await-expr-using-instanceof/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":52}}, + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":52}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":52}}, + "id": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15,"index":15},"end":{"line":1,"column":16,"index":16},"identifierName":"f"}, + "name": "f" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start":19,"end":52,"loc":{"start":{"line":1,"column":19,"index":19},"end":{"line":3,"column":1,"index":52}}, + "body": [ + { + "type": "ExpressionStatement", + "start":23,"end":50,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":29,"index":50}}, + "expression": { + "type": "BinaryExpression", + "start":23,"end":49,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":28,"index":49}}, + "left": { + "type": "AwaitExpression", + "start":23,"end":34,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":13,"index":34}}, + "argument": { + "type": "Identifier", + "start":29,"end":34,"loc":{"start":{"line":2,"column":8,"index":29},"end":{"line":2,"column":13,"index":34},"identifierName":"using"}, + "name": "using" + } + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start":46,"end":49,"loc":{"start":{"line":2,"column":25,"index":46},"end":{"line":2,"column":28,"index":49},"identifierName":"foo"}, + "name": "foo" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +}