disallow invalid async function forms inside object literals - fixes #2629
This commit is contained in:
@@ -712,12 +712,7 @@ pp.parseObj = function (isPattern, refShorthandDefaultPos) {
|
||||
};
|
||||
|
||||
pp.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos) {
|
||||
if (this.eat(tt.colon)) {
|
||||
prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos);
|
||||
return this.finishNode(prop, "ObjectProperty");
|
||||
}
|
||||
|
||||
if (this.match(tt.parenL)) {
|
||||
if (isAsync || isGenerator || this.match(tt.parenL)) {
|
||||
if (isPattern) this.unexpected();
|
||||
prop.kind = "method";
|
||||
prop.method = true;
|
||||
@@ -725,6 +720,11 @@ pp.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync,
|
||||
return this.finishNode(prop, "ObjectMethod");
|
||||
}
|
||||
|
||||
if (this.eat(tt.colon)) {
|
||||
prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos);
|
||||
return this.finishNode(prop, "ObjectProperty");
|
||||
}
|
||||
|
||||
if (!prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (!this.match(tt.comma) && !this.match(tt.braceR))) {
|
||||
if (isGenerator || isAsync || isPattern) this.unexpected();
|
||||
prop.kind = prop.key.name;
|
||||
|
||||
Reference in New Issue
Block a user