Skip to content

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Jul 17, 2025

In script mode:

var x;

must be preserved.

fixes #12341

I took the opportunity to refactor these test cases, and also apply "remove unused assignment expression" to all expressions instead of lone assignment expression.

function foo() {
  var x = 1;
  return x = 2;
}

@github-actions github-actions bot added A-minifier Area - Minifier C-bug Category - Bug labels Jul 17, 2025
Copy link
Member Author

Boshen commented Jul 17, 2025


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.

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 17, 2025

CodSpeed Instrumentation Performance Report

Merging #12351 will not alter performance

Comparing 07-17-fix_minifier_keep_top_level_variable_declarations_in_script_mode (8777839) with main (a55b970)

Summary

✅ 34 untouched benchmarks

@Boshen Boshen force-pushed the 07-17-fix_minifier_keep_top_level_variable_declarations_in_script_mode branch 2 times, most recently from 8e9d999 to bee2de2 Compare July 17, 2025 12:33
@Boshen Boshen changed the title fix(minifier): keep top level variable declarations in script mode fix(minifier): improve remove unused variable declaration Jul 17, 2025
@Boshen Boshen force-pushed the 07-17-fix_minifier_keep_top_level_variable_declarations_in_script_mode branch from bee2de2 to e9b4aa5 Compare July 17, 2025 12:36
@graphite-app
Copy link
Contributor

graphite-app bot commented Jul 17, 2025

Merge activity

In script mode:

```js
var x;
```

must be preserved.

fixes #12341

I took the opportunity to refactor these test cases, and also apply "remove unused assignment expression" to all expressions instead of lone assignment expression.

```js
function foo() {
  var x = 1;
  return x = 2;
}
```
@graphite-app graphite-app bot force-pushed the 07-17-fix_minifier_keep_top_level_variable_declarations_in_script_mode branch from e9b4aa5 to 8777839 Compare July 17, 2025 12:45
@graphite-app graphite-app bot merged commit 8777839 into main Jul 17, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 07-17-fix_minifier_keep_top_level_variable_declarations_in_script_mode branch July 17, 2025 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

minifier: removes top-level variable declarations in scripts

2 participants