mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
9e93ba6908
## Summary - Align auto-accessor initializer parsing with class-field initializer grammar. - Add regressions for `in` in a `for` initializer and disallowed inherited `await`/`yield` contexts. ## Root cause The auto-accessor path only enabled `new.target`. It therefore inherited outer `~In`, `Await`, and `Yield` grammar contexts: `a in b` could not parse in a `for` initializer, while `await` and `yield` could incorrectly parse from enclosing async/generator functions. The fix applies the same `In | NewTarget` addition and `Yield | Await` removal already used for class fields, while retaining AssignmentExpression parsing. ## References - [ECMAScript `FieldDefinition` grammar](https://tc39.es/ecma262/#prod-FieldDefinition) - [ECMAScript `Initializer` grammar](https://tc39.es/ecma262/#prod-Initializer) - [TC39 decorators proposal: class auto-accessors](https://github.com/tc39/proposal-decorators#introduction)
6 lines
60 B
JavaScript
6 lines
60 B
JavaScript
function* f() {
|
|
class C {
|
|
accessor x = yield 1;
|
|
}
|
|
}
|