feat(minifier): merge assignments in sequence exprs to variable declaration#13270
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. |
CodSpeed Instrumentation Performance ReportMerging #13270 will not alter performanceComparing Summary
Footnotes
|
2ada070 to
d75eb97
Compare
92300a2 to
f288210
Compare
d75eb97 to
992af91
Compare
Merge activity
|
…ration (#13270) Compress `var a, b; a = 0, b = 1` into `var a = 0, b = 1`.
f288210 to
a19e84f
Compare
992af91 to
a08dd5a
Compare
…TDZ error would be introduced (#13635) ```js let x; x = (() => x?.a)(); ``` should not be transformed to ```js let x = (() => x?.a)(); ``` , as it would introduce a TDZ error. To fix that, I limited the right hand side of the assignment to be a literal value for let declarations. The precise check would be to check whether the right hand side includes a reference to the variable declared on the left hand side, but I didn't do that for now as it is complicated. If we implement that, we can improve this condition too. https://github.com/oxc-project/oxc/blob/5d597f71c06a9c56fe404a712c05b61e2da3697a/crates/oxc_minifier/src/peephole/minimize_statements.rs#L544-L548 fixes #13615 refs #13270

Compress
var a, b; a = 0, b = 1intovar a = 0, b = 1.