parser: apply ASI when TS contextual keywords precede a newline - #34258
Merged
Claude / Claude Code Review
completed
Jul 15, 2026 in 22m 11s
Code review found 2 potential issues
Found 5 candidates, confirmed 2. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 2 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/js_parser/parse/parse_stmt.rs:1782-1787 |
declare interface\n... / declare abstract\n... now leak trailing tokens as runtime code |
| 🟡 Nit | src/js_parser/parse/parse_stmt.rs:1093 |
@dec export default abstract\nclass still emits Expected "class" but found "class" |
Annotations
Check warning on line 1787 in src/js_parser/parse/parse_stmt.rs
claude / Claude Code Review
`declare interface\n...` / `declare abstract\n...` now leak trailing tokens as runtime code
`declare interface\nFoo\n{ sideEffect() }` and `declare abstract\nclass Foo {}` regress from fully-erased to emitting `Foo; { sideEffect(); }` / a live `class Foo {}`: the new `!has_newline_before` gate falls through, but the `opts.is_export` error check does not fire because on the bare-`declare` path only `opts.is_typescript_declare` is set. Extending the check to `opts.is_export || opts.is_typescript_declare` here (and adding the same check in the `TsStmtAbstract` arm) would match esbuild, wh
Check warning on line 1093 in src/js_parser/parse/parse_stmt.rs
claude / Claude Code Review
`@dec export default abstract\nclass` still emits `Expected "class" but found "class"`
The follow-up in dbabcc1d reworded the decorator+newline error for the `TsStmtAbstract`/`TsStmtDeclare` arms but missed this sibling `export default` path: `@dec export default abstract\nclass Foo {}` now skips the newly-guarded branch and falls through to `p.lexer.expected(T::TClass)?` (~line 1145) while the lexer is already on `T::TClass`, still emitting `Expected "class" but found "class"`. Consider giving this site the same `Unexpected newline after "abstract"` treatment (and adding it to th
Loading