fix: do not eat get/set after async is parsed (#11916)

This commit is contained in:
Huáng Jùnliàng
2020-08-05 09:19:59 -04:00
committed by GitHub
parent de75d4f081
commit 92434269af
3 changed files with 76 additions and 1 deletions

View File

@@ -1754,7 +1754,7 @@ export default class ExpressionParser extends LValParser {
}
// get PropertyName[?Yield, ?Await] () { FunctionBody[~Yield, ~Await] }
// set PropertyName[?Yield, ?Await] ( PropertySetParameterList ) { FunctionBody[~Yield, ~Await] }
if (prop.key.name === "get" || prop.key.name === "set") {
else if (prop.key.name === "get" || prop.key.name === "set") {
isAccessor = true;
isGenerator = this.eat(tt.star); // tt.star is allowed in `maybeAsyncOrAccessorProp`, we will throw in `parseObjectMethod` later
prop.kind = prop.key.name;