swc-project
swc
Blog
Docs
Changelog
Blog
Docs
Changelog
Overview
Branches
Benchmarks
Runs
Performance History
Latest Results
fix(es/compat): preserve for-of var binding scope (#12158) **Description:** The object-rest transform always emitted `let` for declarations moved from a `for-of` head into the loop body. That preserves lexical bindings, but changes an original `var` binding from function scope to block scope and makes it unavailable after the loop. This preserves the original declaration kind, adds fixture coverage for `var`/`let`/`const`, and adds a runtime regression that checks both post-loop `var` access and per-iteration lexical bindings. Verified with the focused object-rest fixture and runtime tests, `cargo fmt`, and Clippy for the affected crates. **Related issue (if exists):** Fixes #12153
main
58 minutes ago
fix(es/minifier): preserve do-while control-flow targets (#12160) **Description:** The minifier's `loops` optimization replaces a constant-false `do...while` statement with its body. It previously allowed a direct `break` or `continue` while doing so, even though those statements target the loop being removed. After unwrapping, the abrupt completion could target a surrounding loop and silently change program behavior, or become an illegal statement when no enclosing target existed. This change passes `false` for `allow_break_continue` when checking a constant-false `do...while` body. SWC now retains the loop when a direct `break` or `continue` depends on it, while other safe constant-false loop bodies remain eligible for unwrapping. The regression fixture covers: - unlabeled and labeled `break` statements nested in an outer loop; - unlabeled and labeled `continue` statements nested in an outer loop; - declaration hoisting after an early `break`. Labels are not required to reproduce the bug. The labeled cases are included because they match the Kotlin/JS output reported in web-infra-dev/rspack#15335; after label normalization they expose the same direct control-flow dependency. A similar semantic guard exists in the separate `simplify` transform following #1618. This change applies that constraint to the minifier compressor's independent constant-loop optimization. **Testing:** - `UPDATE=1 cargo test -p swc_ecma_minifier --test compress --features concurrent do_while_false_control_flow -- --nocapture` - `cargo test -p swc_ecma_minifier --test compress --features concurrent do_while_false_control_flow -- --nocapture` - `(cd crates/swc_ecma_minifier && ./scripts/exec.sh)` - `cargo test -p swc_ecma_minifier` - `cargo fmt --all` - `cargo clippy -p swc_ecma_minifier --all-targets --features concurrent -- -D warnings` **BREAKING CHANGE:** None. **Related issue (if exists):** Fixes #12159. Related to web-infra-dev/rspack#15335. See also #1618.
main
59 minutes ago
chore: Add changeset
August-Z:codex/fix-do-while-false-control-flow
2 hours ago
chore: Add changeset
August-Z:codex/fix-do-while-false-control-flow
2 hours ago
fix(es/parser): Preserve await grammar boundaries (#12156) **Description:** Follow-up to #12142. Compared with `main`, this PR: - refines Script/Module retry decisions around ambiguous `await` expressions; - handles line breaks, escaped contextual keywords, `!`, and `in` correctly; - fixes `await` handling in class fields, static blocks, and `await using`; - preserves the original Module result and diagnostics when both parses fail; Some edge cases were identified during the code review of #12142, including `await!`, static-block `await`, and the line break in `await\nusing`. **Related issue:** - #12142
main
4 hours ago
perf(ecma_utils): Avoid allocating for overflowing radix strings radix_str_to_number collected every digit of a radix-prefixed string into a Vec<u32> before ever using more than a bounded prefix, so a huge numeric literal allocated and fully decoded far more than needed. Operate on the byte slice directly instead: locate the first significant byte and scan for a nonzero remainder without decoding.
YosefBlandin:feat/minifier-math-constant-folding
5 hours ago
fix(ecma_utils): Round overflowing radix strings only once Accumulating hex/octal/binary digits into a f64 one at a time rounds after every multiply-add, which can drift a ULP away from rounding the exact integer once (as ECMAScript requires). Extract the top ~53 bits directly and round-to-nearest-even against a sticky bit instead. Also list swc_ecma_utils in the release changeset, since the fix lives there, and note in a nearby comment that Math folding already leans on this crate's documented "built-ins are not overridden" assumption.
YosefBlandin:feat/minifier-math-constant-folding
6 hours ago
Merge branch 'main' into feat/minifier-math-constant-folding
YosefBlandin:feat/minifier-math-constant-folding
6 hours ago
Latest Branches
CodSpeed Performance Gauge
0%
fix(es/minifier): preserve do-while control-flow targets
#12160
3 hours ago
4034ad9
August-Z:codex/fix-do-while-false-control-flow
CodSpeed Performance Gauge
0%
feat(es/minifier): Evaluate Math.floor, Math.ceil, Math.round and Mat…
#12117
5 hours ago
b5806f4
YosefBlandin:feat/minifier-math-constant-folding
CodSpeed Performance Gauge
+2%
fix(es/compat): preserve for-of var binding scope
#12158
8 hours ago
900e9fd
mameikagou:fix/object-rest-for-of-var-scope-v2
© 2026 CodSpeed Technology
Home
Terms
Privacy
Docs