mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
9fa2122cef
Fixes parser recovery for class computed property names whose expression starts with an array literal, such as `class C { [[]]() {} }`.
The TypeScript index-signature lookahead previously treated a nested `[` after the opening computed-name bracket as an unambiguous index signature. That caused valid class computed keys containing array literals to be parsed through the wrong branch and rejected.
This changes the lookahead so only `...` remains an early unambiguous index-signature signal, allowing nested arrays and other assignment expressions to parse as computed property names.
fixes: #22157
14 lines
131 B
JavaScript
14 lines
131 B
JavaScript
class C {
|
|
[[]]() {}
|
|
[[1]]() {}
|
|
[[]] = 1;
|
|
}
|
|
|
|
const o = { [[]]() {} };
|
|
|
|
const x = [];
|
|
class x2 {
|
|
[[...x]]() {}
|
|
[.1]() {}
|
|
}
|