Bug 1185106 - Part 9.1: Support async function statement in export default in Parser. r=efaust,till
authorTooru Fujisawa <arai_a@mac.com>
Sun, 28 Aug 2016 23:58:29 +0900
changeset 320240 0e9b413f34392cd8e1bdda5cb230091a204fb5ef
parent 320239 92f7082a90be77700618e8176c73ad7538ee75a3
child 320241 e042b0dba45525afea60180c2851bee4785a1855
push id20754
push usercbook@mozilla.com
push dateMon, 31 Oct 2016 15:58:35 +0000
treeherderfx-team@b1b66b1780c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersefaust, till
bugs1185106
milestone52.0a1
Bug 1185106 - Part 9.1: Support async function statement in export default in Parser. r=efaust,till MozReview-Commit-ID: 5oe1f3MRssu
js/src/frontend/Parser.cpp
--- 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);