Skip to content

feat(minifier): remove optional chaining calls when the function is undefined or null#12956

Merged
graphite-app[bot] merged 1 commit intomainfrom
08-10-feat_minifier_remove_optional_chaining_calls_when_the_function_is_undefined_or_null_
Aug 10, 2025
Merged

feat(minifier): remove optional chaining calls when the function is undefined or null#12956
graphite-app[bot] merged 1 commit intomainfrom
08-10-feat_minifier_remove_optional_chaining_calls_when_the_function_is_undefined_or_null_

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Aug 10, 2025

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

@github-actions github-actions bot added A-minifier Area - Minifier C-enhancement Category - New feature or request labels Aug 10, 2025
Copy link
Member Author


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.

@sapphi-red sapphi-red marked this pull request as ready for review August 10, 2025 07:45
Copilot AI review requested due to automatic review settings August 10, 2025 07:45
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 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_chain to 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-hq
Copy link

codspeed-hq bot commented Aug 10, 2025

CodSpeed Instrumentation Performance Report

Merging #12956 will not alter performance

Comparing 08-10-feat_minifier_remove_optional_chaining_calls_when_the_function_is_undefined_or_null_ (96a1a4f) with main (47a565f)

Summary

✅ 34 untouched benchmarks

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Aug 10, 2025
Copy link
Member

Boshen commented Aug 10, 2025

Merge activity

…undefined` or `null` (#12956)

Compress `undefined?.()` / `null?.()` into `undefined`.
@graphite-app graphite-app bot force-pushed the 08-10-feat_minifier_remove_optional_chaining_calls_when_the_function_is_undefined_or_null_ branch from c2c5a8b to 96a1a4f Compare August 10, 2025 08:52
@graphite-app graphite-app bot merged commit 96a1a4f into main Aug 10, 2025
30 checks passed
@graphite-app graphite-app bot deleted the 08-10-feat_minifier_remove_optional_chaining_calls_when_the_function_is_undefined_or_null_ branch August 10, 2025 08:58
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 10, 2025
taearls pushed a commit to taearls/oxc that referenced this pull request Aug 12, 2025
…undefined` or `null` (oxc-project#12956)

Compress `undefined?.()` / `null?.()` into `undefined`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants