properly distinguish shorthand async keys that are the last property - fixes #2176

This commit is contained in:
Sebastian McKenzie
2015-08-06 19:33:48 +01:00
parent 5ec9f78493
commit 4fda34ce6f
3 changed files with 150 additions and 1 deletions

View File

@@ -593,7 +593,7 @@ pp.parseObj = function (isPattern, refShorthandDefaultPos) {
if (!isPattern && this.options.features["es7.asyncFunctions"] && this.isContextual("async")) {
if (isGenerator) this.unexpected();
var asyncId = this.parseIdent();
if (this.match(tt.colon) || this.match(tt.parenL)) {
if (this.match(tt.colon) || this.match(tt.parenL) || this.match(tt.braceR)) {
prop.key = asyncId;
} else {
isAsync = true;