Merge pull request #1455 from monsanto/fix-async-constructor

Disallow async constructors
This commit is contained in:
Sebastian McKenzie 2015-05-06 15:12:12 +01:00
commit f6219ec15a
3 changed files with 6 additions and 1 deletions

View File

@ -504,7 +504,7 @@ pp.parseClass = function(node, isStatement) {
this.parsePropertyName(method)
}
method.kind = "method"
if (!method.computed && !isGenerator) {
if (!method.computed && !isGenerator && !isAsync) {
if (method.key.type === "Identifier") {
if (this.type !== tt.parenL && (method.key.name === "get" || method.key.name === "set")) {
method.kind = method.key.name

View File

@ -0,0 +1 @@
class X { async constructor() {} }

View File

@ -0,0 +1,4 @@
{
"throws": "Illegal kind for constructor method",
"optional": ["es7.asyncFunctions"]
}