Latest Results
refactor(es/parser): Isolate parser state and make grammar parameters explicit (#12425)
**Description:**
Refactor parser state and construction paths while preserving existing
AST structures.
- Separate grammatical parameters (`In`, `Yield`, `Await`, and `Return`)
from lexical, syntax, boundary, statement, and type contexts.
- Model statement entry grammar and function-body boundaries explicitly.
- Decouple type grammar from angle-operator tokenization and centralize
type-closing behavior.
- Share parameter parsing and validation while constructing the
representation required by each consumer.
- Reduce unnecessary Flow speculation, trailing-comma bookkeeping, and
identifier escape-buffer allocations; share ASCII word scanning.
This PR does not change AST node definitions or serialization schemas.
No test or fixture files are changed.
Existing parser tests passed with default and all features, along with
the no-default-features check and workspace Clippy. Local measurements
did not establish a consistent overall speedup; allocation
instrumentation confirmed fewer reallocations when parsing non-empty
generic async arrow parameter lists.
**BREAKING CHANGE:**
The low-level public Rust parser API changes:
- `Context` now contains only lexical flags and uses `u8` instead of
`u32`. Parser-only flags have been removed.
- Callers using `Context::CanBeModule` should use
`Parser::allow_module_syntax()`.
- Custom `Tokens` implementations must implement `rescan_type_gt`.
- `Buffer::merge_lt_gt` is replaced by `Buffer::eat_type_gt`, with
different semantics.
These changes also affect consumers accessing the parser through
`swc_core::ecma::parser`. AST structures remain unchanged.
**Related issue (if exists):**
- Close #12451 Latest Branches
+3%
codex/fix-windows-native-cache-12442 0%
codex/fix-env-for-await-12399 0%
codex/fix-wasmtime-advisory-0316 © 2026 CodSpeed Technology