Skip to content

feat(minifier): fold expr ?? 1 for non-null undetermined expressions #10687

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DonIsaac
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the A-minifier Area - Minifier label Apr 29, 2025
Copy link
Contributor 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.

@github-actions github-actions bot added the C-enhancement Category - New feature or request label Apr 29, 2025
@DonIsaac DonIsaac marked this pull request as ready for review April 29, 2025 04:46
Copy link

codspeed-hq bot commented Apr 29, 2025

CodSpeed Instrumentation Performance Report

Merging #10687 will not alter performance

Comparing don/04-28-feat_minifier_fold_expr_1_for_non-null_undetermined_expressions (eaf4f8a) with main (746b318)

Summary

✅ 36 untouched benchmarks

| Expression::BinaryExpression(_)
| Expression::UpdateExpression(_) => Some(false),
Expression::Identifier(id) => match id.name.as_str() {
"undefined" => Some(true),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are special methods for checking these, they can be global.

I can't recall what they are, try and find them yourself ;-)

},
Expression::LogicalExpression(expr) => {
let left = Self::is_nullish(&expr.left);
let right = Self::is_nullish(&expr.right);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to compute the rhs until it is necessary.

@Boshen Boshen marked this pull request as draft May 1, 2025 13:44
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.

2 participants