fix(minifier): evaluate e ? consequent : alternate#12940
fix(minifier): evaluate e ? consequent : alternate#12940graphite-app[bot] merged 1 commit intomainfrom
e ? consequent : alternate#12940Conversation
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. |
There was a problem hiding this comment.
Pull Request Overview
This PR improves the minifier's constant evaluation for conditional expressions by enhancing the logic that converts patterns like a ? true : false to !!a and a ? false : true to !a. Instead of only matching literal boolean values, the updated code now evaluates expressions that resolve to boolean values.
- Moved and enhanced the conditional expression optimization logic to evaluate expressions that can be reduced to boolean values
- Added constant evaluation capability to handle more complex expressions that resolve to true/false
- Added comprehensive test cases to verify the enhanced boolean evaluation logic
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/oxc_minifier/src/peephole/minimize_conditional_expression.rs | Enhanced conditional expression optimization to use constant evaluation instead of literal matching |
| crates/oxc_minifier/src/peephole/fold_constants.rs | Added test cases for the improved boolean evaluation logic |
CodSpeed Instrumentation Performance ReportMerging #12940 will not alter performanceComparing Summary
|
3143f7c to
a5881e9
Compare
Merge activity
|
a5881e9 to
ad4aeaf
Compare

No description provided.