-
-
Notifications
You must be signed in to change notification settings - Fork 720
fix(minifier): evaluate e ? consequent : alternate
#12940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(minifier): evaluate e ? consequent : alternate
#12940
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. |
There was a problem hiding this 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 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.