Skip to content

Commit

Permalink
Set generator to true during error recovery of accessor (#11987)
Browse files Browse the repository at this point in the history
  • Loading branch information
existentialism committed Aug 21, 2020
1 parent b9407d7 commit 941f610
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/babel-parser/src/parser/expression.js
Expand Up @@ -1767,6 +1767,7 @@ export default class ExpressionParser extends LValParser {
isAccessor = true;
prop.kind = keyName;
if (this.match(tt.star)) {
isGenerator = true;
this.raise(this.state.pos, Errors.AccessorIsGenerator, keyName);
this.next();
}
Expand Down Expand Up @@ -1827,7 +1828,9 @@ export default class ExpressionParser extends LValParser {
// isAccessor implies isAsync: false, isPattern: false, isGenerator: false
this.parseMethod(
prop,
/* isGenerator */ false,
// This _should_ be false, but with error recovery, we allow it to be
// set for informational purposes
isGenerator,
/* isAsync */ false,
/* isConstructor */ false,
false,
Expand Down
Expand Up @@ -30,7 +30,7 @@
"computed": false,
"kind": "get",
"id": null,
"generator": false,
"generator": true,
"async": false,
"params": [],
"body": {
Expand All @@ -52,7 +52,7 @@
"computed": false,
"kind": "set",
"id": null,
"generator": false,
"generator": true,
"async": false,
"params": [
{
Expand Down

0 comments on commit 941f610

Please sign in to comment.