Avatar for the oxc-project user
oxc-project
oxc
BlogDocsChangelog

Performance History

Latest Results

fix(mangler): prevent slot reuse for block-scoped functions in sloppy mode In sloppy mode JavaScript, function declarations inside blocks (if, try, switch, {}) have Annex B.3.2.1 semantics: they create an implicit var-like assignment in the enclosing function scope at block exit. The mangler was treating these as purely block-scoped (like let/const), allowing slot reuse with outer var bindings. When both got the same mangled name, the Annex B assignment would overwrite the outer variable at runtime, changing program behavior. The fix has two parts: 1. Annex B function declarations in sloppy block scopes are partitioned to the end of bindings and always get fresh slots (never reuse existing ones) 2. Their slot liveness is extended upward to the enclosing var-scope, preventing sibling scopes from reusing their slots either Strict mode and ES modules are unaffected (no Annex B, no size regression). Fixes #20610 Fixes #14316 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix/mangler-annex-b-block-scoped-function
43 minutes ago
feat(parser): mark pure comments that cannot be applied (#20687) ## Summary Adds `CommentContent::PureNotApplied` variant to flag `#__PURE__` / `@__PURE__` annotations that cannot be applied, aligning with [Rollup's behavior](https://rollupjs.org/configuration-options/#pure) for invalid pure comment positions. ### Changes - `set_pure_on_call_or_new_expr` now returns `bool` so callers detect when the annotation couldn't be applied - Track the specific pure comment index (`Option<usize>`) instead of a boolean flag, fixing a bug where the wrong comment could be retagged when multiple pure comments exist (e.g. `/*#__PURE__*/ foo + /*#__PURE__*/ bar()`) - Mark pure comments as `PureNotApplied` in three contexts: - **Expression-level**: annotation not before a call/new expression (e.g. `/* #__PURE__ */ a().b`) - **Statement-level**: annotation before non-expression statements (e.g. `/* #__PURE__ */ function foo() {}`) - **Variable declarator**: annotation before `=` (e.g. `const foo /* #__PURE__ */ = bar()`) - Downstream consumers (codegen, minifier, Rolldown) can check for `PureNotApplied` to warn or strip Closes #20334 Rolldown will add custom logic to emit the comments that are `PureNotApplied` so it does not affect the rest of the compiler pipeline. ## Test plan - [x] Unit tests for all `PureNotApplied` cases (expression, statement, variable declarator) - [x] Regression test for correct comment targeting with multiple pure comments - [x] Codegen integration tests updated - [x] `cargo test -p oxc_parser -p oxc_codegen` passes šŸ¤– Generated with [Claude Code](https://claude.com/claude-code)
main
1 hour ago
[autofix.ci] apply automated fixes
boshen/pure-comment-not-applied
2 hours ago

Latest Branches

CodSpeed Performance Gauge
0%
fix(mangler): prevent slot reuse for block-scoped functions in sloppy mode#20705
11 hours ago
9d7cb62
fix/mangler-annex-b-block-scoped-function
CodSpeed Performance Gauge
0%
feat(parser): mark pure comments that cannot be applied#20687
2 hours ago
5a821b7
boshen/pure-comment-not-applied
CodSpeed Performance Gauge
0%
Ā© 2026 CodSpeed Technology
Home Terms Privacy Docs