Check for function when parsing export async (#639)
This commit is contained in:
parent
fa4d4040dc
commit
a46f87f726
@ -1255,6 +1255,15 @@ export default class StatementParser extends ExpressionParser {
|
||||
this.checkExport(node, true, true);
|
||||
return this.finishNode(node, "ExportDefaultDeclaration");
|
||||
} else if (this.shouldParseExportDeclaration()) {
|
||||
if (this.isContextual("async")) {
|
||||
const next = this.lookahead();
|
||||
|
||||
// export async;
|
||||
if (next.type !== tt._function) {
|
||||
this.unexpected(next.start, "Unexpected token, expected function");
|
||||
}
|
||||
}
|
||||
|
||||
node.specifiers = [];
|
||||
node.source = null;
|
||||
node.declaration = this.parseExportDeclaration(node);
|
||||
|
||||
1
test/fixtures/es2017/async-functions/export-async/actual.js
vendored
Normal file
1
test/fixtures/es2017/async-functions/export-async/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
export async;
|
||||
4
test/fixtures/es2017/async-functions/export-async/options.json
vendored
Normal file
4
test/fixtures/es2017/async-functions/export-async/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"sourceType": "module",
|
||||
"throws": "Unexpected token, expected function (1:12)"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user