From 9219b7f7bf486e007948f94fd20113ab792290ff Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 17 Jul 2015 23:31:46 -0700 Subject: [PATCH] don't return from within parseSubscripts when we parse an async arrow function - fixes #2027 --- src/expression.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/expression.js b/src/expression.js index fc1eea4f8f..9da6929003 100755 --- a/src/expression.js +++ b/src/expression.js @@ -244,7 +244,7 @@ pp.parseSubscripts = function(base, startPos, startLoc, noCalls) { base = this.finishNode(node, "CallExpression"); if (possibleAsync && (this.type === tt.colon || this.type === tt.arrow)) { - return this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), node); + base = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), node); } } else if (this.type === tt.backQuote) { let node = this.startNodeAt(startPos, startLoc); @@ -315,7 +315,7 @@ pp.parseExprAtom = function (refShorthandDefaultPos) { } else if (id.name === "async" && this.type === tt._function && !this.canInsertSemicolon()) { this.next(); return this.parseFunction(node, false, false, true); - } else if (id.name === "async" && this.type === tt.name) { + } else if (canBeArrow && id.name === "async" && this.type === tt.name) { var params = [this.parseIdent()]; this.expect(tt.arrow); // var foo = bar => {};