Bug 1185106 - Part 9.1: Support async function statement in export default in Parser. r=efaust,till
MozReview-Commit-ID: 5oe1f3MRssu
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -5042,16 +5042,30 @@ Parser<FullParseHandler>::exportDeclarat
return null();
break;
case TOK_CLASS:
kid = classDefinition(YieldIsKeyword, ClassStatement, AllowDefaultName);
if (!kid)
return null();
break;
default: {
+ if (tt == TOK_NAME && tokenStream.currentName() == context->names().async) {
+ TokenKind nextSameLine = TOK_EOF;
+ if (!tokenStream.peekTokenSameLine(&nextSameLine))
+ return null();
+
+ if (nextSameLine == TOK_FUNCTION) {
+ tokenStream.consumeKnownToken(nextSameLine);
+ kid = functionStmt(YieldIsName, AllowDefaultName, AsyncFunction);
+ if (!kid)
+ return null();
+ break;
+ }
+ }
+
tokenStream.ungetToken();
RootedPropertyName name(context, context->names().starDefaultStar);
nameNode = newName(name);
if (!nameNode)
return null();
if (!noteDeclaredName(name, DeclarationKind::Const, pos()))
return null();
kid = assignExpr(InAllowed, YieldIsKeyword, TripledotProhibited);