fix(minifier): prevent expression inlining into block-scoped for-in declarations#18651
Conversation
|
@copilot update |
Updated Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Fixes a minifier correctness bug where expression statements were inlined into for-in loops with block-scoped (let/const) loop bindings, which can introduce variable shadowing and change runtime behavior.
Changes:
- Prevent sequence inlining into
for-inwhen the loop LHS is a non-varvariable declaration. - Add regression tests covering
let,const,var, and undeclaredfor-inLHS forms. - Update the minifier memory allocation snapshot.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| crates/oxc_minifier/src/peephole/minimize_statements.rs | Adds a guard to avoid inlining into block-scoped for-in declarations to prevent shadowing bugs. |
| crates/oxc_minifier/tests/peephole/minimize_statements.rs | Adds regression tests for let/const (no inline) and var/identifier (inline) behavior. |
| tasks/track_memory_allocations/allocs_minifier.snap | Updates allocation snapshot reflecting the change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
5aabc89 to
2e34461
Compare
### 💥 BREAKING CHANGES - 445cb1a oxc_allocator: [**BREAKING**] Remove dangerous `Allocator` methods (#18715) (overlookmotel) ### 🚀 Features - 8670b18 parser: Error on ambient class accessor implementations (#18592) (camc314) ### 🐛 Bug Fixes - 2e34461 minifier: Prevent expression inlining into block-scoped for-in declarations (#18651) (copilot-swe-agent) ### 📚 Documentation - 3d01fa1 transformer: Update links to use Oxc docs (#18722) (sapphi-red) Co-authored-by: camc314 <[email protected]>
No description provided.