feat(minifier): compress return void foo() => foo(); return#13271
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 implements a minification optimization that transforms return void foo() to foo(); return when the expression evaluates to undefined. This builds on existing optimizations for return void 0 and return undefined patterns.
- Adds logic to detect return statements with arguments that evaluate to undefined and have side effects
- Transforms these statements by extracting the side-effect expression and creating a bare return
- Updates test expectations to reflect the new optimization behavior
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/oxc_minifier/src/peephole/minimize_statements.rs | Implements the core optimization logic for return void foo() transformation |
| crates/oxc_minifier/src/peephole/substitute_alternate_syntax.rs | Updates test case to expect the new optimized output |
| tasks/minsize/minsize.snap | Minor improvement in gzip size measurement for typescript.js |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Instrumentation Performance ReportMerging #13271 will not alter performanceComparing Summary
Footnotes |
a2c517f to
d047315
Compare
Merge activity
|
Compress `return void foo()` => `foo(); return`. `return void 0` and `return undefined` was handled but this wasn't.
d047315 to
c84d763
Compare
Compress `return void foo()` => `foo(); return`. `return void 0` and `return undefined` was handled but this wasn't.
c84d763 to
533a74a
Compare
Compress `return void foo()` => `foo(); return`. `return void 0` and `return undefined` was handled but this wasn't.
533a74a to
cae222c
Compare

Compress
return void foo()=>foo(); return.return void 0andreturn undefinedwas handled but this wasn't.