Skip to content

Commit

Permalink
Pass isAsync as argument to parseFunctionStatement
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Sep 5, 2016
1 parent b12370f commit 7c75f92
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pp.parseStatement = function(declaration, topLevel, exports) {
case tt._for: return this.parseForStatement(node)
case tt._function:
if (!declaration && this.options.ecmaVersion >= 6) break
return this.parseFunctionStatement(node)
return this.parseFunctionStatement(node, false)
case tt._class:
if (!declaration) this.unexpected()
return this.parseClass(node, true)
Expand Down Expand Up @@ -115,7 +115,8 @@ pp.parseStatement = function(declaration, topLevel, exports) {
}

if (this.isAsyncFunction() && declaration) {
return this.parseFunctionStatement(node)
this.next()
return this.parseFunctionStatement(node, true)
}

// If the statement does not start with a statement keyword or a
Expand Down Expand Up @@ -209,8 +210,7 @@ pp.parseForStatement = function(node) {
return this.parseFor(node, init)
}

pp.parseFunctionStatement = function(node) {
let isAsync = this.options.ecmaVersion >= 8 && this.eatContextual("async")
pp.parseFunctionStatement = function(node, isAsync) {
this.next()
return this.parseFunction(node, true, false, isAsync)
}
Expand Down

0 comments on commit 7c75f92

Please sign in to comment.