From 2dd57d17b9014902b8121c393524dd9cfd4807fe Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 23 Feb 2017 09:50:33 -0500 Subject: [PATCH] Revert "Fix export default async function to be FunctionDeclaration" (#375) --- src/parser/statement.js | 2 - .../es2017/async-functions/export/actual.js | 2 - .../async-functions/export/expected.json | 172 ------------------ .../async-functions/export/options.json | 3 - 4 files changed, 179 deletions(-) delete mode 100644 test/fixtures/es2017/async-functions/export/actual.js delete mode 100644 test/fixtures/es2017/async-functions/export/expected.json delete mode 100644 test/fixtures/es2017/async-functions/export/options.json diff --git a/src/parser/statement.js b/src/parser/statement.js index 42a01b1866..f7f950574a 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -835,8 +835,6 @@ pp.parseExport = function (node) { let needsSemi = false; if (this.eat(tt._function)) { expr = this.parseFunction(expr, true, false, false, true); - } else if (this.eatContextual("async") && this.eat(tt._function)) { - expr = this.parseFunction(expr, true, false, true, true); } else if (this.match(tt._class)) { expr = this.parseClass(expr, true, true); } else { diff --git a/test/fixtures/es2017/async-functions/export/actual.js b/test/fixtures/es2017/async-functions/export/actual.js deleted file mode 100644 index 3f043e6176..0000000000 --- a/test/fixtures/es2017/async-functions/export/actual.js +++ /dev/null @@ -1,2 +0,0 @@ -export async function foo() {} -export default async function bar() {} diff --git a/test/fixtures/es2017/async-functions/export/expected.json b/test/fixtures/es2017/async-functions/export/expected.json deleted file mode 100644 index a19d6f157b..0000000000 --- a/test/fixtures/es2017/async-functions/export/expected.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ExportNamedDeclaration", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "specifiers": [], - "source": null, - "declaration": { - "type": "FunctionDeclaration", - "start": 7, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "id": { - "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "generator": false, - "expression": false, - "async": true, - "params": [], - "body": { - "type": "BlockStatement", - "start": 28, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "body": [], - "directives": [] - } - } - }, - { - "type": "ExportDefaultDeclaration", - "start": 31, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "declaration": { - "type": "FunctionDeclaration", - "start": 46, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "id": { - "type": "Identifier", - "start": 61, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 33 - }, - "identifierName": "bar" - }, - "name": "bar" - }, - "generator": false, - "expression": false, - "async": true, - "params": [], - "body": { - "type": "BlockStatement", - "start": 67, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "body": [], - "directives": [] - } - } - } - ], - "directives": [] - } -} diff --git a/test/fixtures/es2017/async-functions/export/options.json b/test/fixtures/es2017/async-functions/export/options.json deleted file mode 100644 index 2104ca4328..0000000000 --- a/test/fixtures/es2017/async-functions/export/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "sourceType": "module" -}