feat(minifier): remove optional chaining calls when the function is undefined or null#12956
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.
Pull Request Overview
This PR extends the minifier's fold constants optimization to handle optional chaining call expressions where the callee is undefined or null, compressing them to undefined (represented as void 0).
- Extended
try_fold_optional_chainto handle call expressions in addition to member expressions - Added pattern matching to handle both member and call expressions in chain expressions
- Added test coverage for the new optimization cases
CodSpeed Instrumentation Performance ReportMerging #12956 will not alter performanceComparing Summary
|
Merge activity
|
…undefined` or `null` (#12956) Compress `undefined?.()` / `null?.()` into `undefined`.
c2c5a8b to
96a1a4f
Compare
…undefined` or `null` (oxc-project#12956) Compress `undefined?.()` / `null?.()` into `undefined`.

Compress
undefined?.()/null?.()intoundefined.