fix patterns with async keys - fixes #2171

This commit is contained in:
Sebastian McKenzie
2015-08-05 23:22:31 +01:00
parent 9826be30cc
commit 5ec9f78493
4 changed files with 195 additions and 3 deletions

View File

@@ -587,10 +587,11 @@ pp.parseObj = function (isPattern, refShorthandDefaultPos) {
startPos = this.state.start;
startLoc = this.state.startLoc;
}
if (!isPattern)
if (!isPattern) {
isGenerator = this.eat(tt.star);
if (this.options.features["es7.asyncFunctions"] && this.isContextual("async")) {
if (isGenerator || isPattern) this.unexpected();
}
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)) {
prop.key = asyncId;