mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
d4f6545078
Improves error message for imbalanced tokens. ``` × Expected `,` or `]` but found `const` ╭─[misc/fail/imbalanced-array-expr.js:2:1] 1 │ const foo = [0, 1 · ┬ · ╰── Opened here 2 │ const bar = 2 · ──┬── · ╰── `,` or `]` expected ╰──── ``` The error message for this case was: ``` x Expected `,` but found `const` ,-[:2:1] 1 | const foo = [0,1 2 | const bar = 2 : ^^|^^ : `-- `,` expected `---- ``` This change makes it clear why the parser is expecting `,` and also tell that it can be fixed by adding the closing token somewhere.
3 lines
37 B
JavaScript
3 lines
37 B
JavaScript
const foo = new Foo(1
|
|
const bar = 2;
|