Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Commit

Permalink
Check for function when parsing export async (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
existentialism authored and hzoo committed Jul 19, 2017
1 parent fa4d404 commit a46f87f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/parser/statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export async;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sourceType": "module",
"throws": "Unexpected token, expected function (1:12)"
}

0 comments on commit a46f87f

Please sign in to comment.