From c026e2bf7e967e4f95e51a5f97ed92d7e4902631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 30 Dec 2019 19:43:43 -0500 Subject: [PATCH] chore: add test on await in computed class property --- .../input.js | 3 + .../output.json | 177 ++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js new file mode 100644 index 000000000000..d18a372142f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js @@ -0,0 +1,3 @@ +async () => class { + [await 42]() { } +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json new file mode 100644 index 000000000000..2518cd543d0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "ClassExpression", + "start": 12, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 18, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 22, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "static": false, + "computed": true, + "key": { + "type": "AwaitExpression", + "start": 23, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file