make method definitions with expression bodies illegal - fixes #1066

This commit is contained in:
Sebastian McKenzie 2015-03-23 20:24:32 +11:00
parent 2cbbd86552
commit 6d87a99d1d

View File

@ -597,14 +597,10 @@ pp.parseMethod = function(isGenerator, isAsync) {
this.initFunction(node, isAsync)
this.expect(tt.parenL)
node.params = this.parseBindingList(tt.parenR, false, false)
let allowExpressionBody
if (this.options.ecmaVersion >= 6) {
node.generator = isGenerator
allowExpressionBody = true
} else {
allowExpressionBody = false
}
this.parseFunctionBody(node, allowExpressionBody)
this.parseFunctionBody(node)
return this.finishNode(node, "FunctionExpression")
}