fix(minifier): skip inlining constant in scopes with eval#17926
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
2c7ac9a to
115beab
Compare
115beab to
dcbbeac
Compare
There was a problem hiding this comment.
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::DirectEvalflag - Modified the
init_valuemethod 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 Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
crates/oxc_minifier/tests/peephole/inline_single_use_variable.rs
Outdated
Show resolved
Hide resolved
7f42b13 to
8e324ee
Compare
8e324ee to
0622429
Compare
0622429 to
5b501b9
Compare
Merge activity
|
5b501b9 to
ee353e6
Compare

fixes rolldown/rolldown#7846