Skip to content

fix(minifier): skip inlining constant in scopes with eval#17926

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/01-12-fix_minifier_skip_inlining_constant_in_scopes_with_eval
Jan 16, 2026
Merged

fix(minifier): skip inlining constant in scopes with eval#17926
graphite-app[bot] merged 1 commit intomainfrom
c/01-12-fix_minifier_skip_inlining_constant_in_scopes_with_eval

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Jan 12, 2026

@camc314 camc314 marked this pull request as ready for review January 12, 2026 11:36
Copilot AI review requested due to automatic review settings January 12, 2026 11:36
@github-actions github-actions bot added A-minifier Area - Minifier C-bug Category - Bug labels Jan 12, 2026
Copy link
Contributor Author

camc314 commented Jan 12, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@camc314 camc314 force-pushed the c/01-12-fix_minifier_skip_inlining_constant_in_scopes_with_eval branch from 2c7ac9a to 115beab Compare January 12, 2026 11:36
@camc314 camc314 force-pushed the c/01-12-fix_minifier_skip_inlining_constant_in_scopes_with_eval branch from 115beab to dcbbeac Compare January 12, 2026 11:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the minifier where constant values were being incorrectly inlined in scopes containing eval() calls. Since eval() can modify variables in the current and parent scopes at runtime, constant inlining in such scopes could lead to incorrect behavior.

Changes:

  • Added logic to detect scopes with direct eval using the ScopeFlags::DirectEval flag
  • Modified the init_value method to skip constant initialization when eval is present
  • Added comprehensive test cases to verify variables are not inlined in eval scopes

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/oxc_minifier/src/ctx.rs Added DirectEval flag check to prevent constant inlining in scopes containing eval
crates/oxc_minifier/tests/peephole/inline_single_use_variable.rs Added test cases verifying variables are not inlined when eval is present in scope

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 12, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing c/01-12-fix_minifier_skip_inlining_constant_in_scopes_with_eval (5b501b9) with main (8ee6f80)

Summary

✅ 38 untouched benchmarks
⏩ 7 skipped benchmarks1

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@camc314 camc314 force-pushed the c/01-12-fix_minifier_skip_inlining_constant_in_scopes_with_eval branch 2 times, most recently from 7f42b13 to 8e324ee Compare January 12, 2026 13:18
@Boshen Boshen self-assigned this Jan 14, 2026
@camc314 camc314 force-pushed the c/01-12-fix_minifier_skip_inlining_constant_in_scopes_with_eval branch from 8e324ee to 0622429 Compare January 15, 2026 12:06
@camc314 camc314 force-pushed the c/01-12-fix_minifier_skip_inlining_constant_in_scopes_with_eval branch from 0622429 to 5b501b9 Compare January 15, 2026 14:12
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Jan 16, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 16, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the c/01-12-fix_minifier_skip_inlining_constant_in_scopes_with_eval branch from 5b501b9 to ee353e6 Compare January 16, 2026 05:26
@graphite-app graphite-app bot merged commit ee353e6 into main Jan 16, 2026
21 checks passed
@graphite-app graphite-app bot deleted the c/01-12-fix_minifier_skip_inlining_constant_in_scopes_with_eval branch January 16, 2026 05:33
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Rolldown optimizes out scope variable assigned by eval

5 participants