Commit a29bf4b
fix(es/minifier): Make parameter inlining more conservative
This commit fixes the parameter inlining optimization to be more conservative about what values are considered safe to inline. Previously, the optimization would inline any resolved identifier (local variable), which caused issues where:
1. Inlining variable references doesn't save code - it just moves a reference from one place to another
2. It can interfere with other optimizations like function body inlining
3. It changes code structure in ways that may not be beneficial
The fix restricts parameter inlining to only inline true constants:
- Literal values (null, boolean, number, string, bigint)
- The special `undefined` identifier (unresolved global)
- Unary expressions of the above (e.g., -1, !true)
Variable references are no longer inlined, as the goal of this optimization is to inline constant values, not to move variable references around.
This fixes all failing tests in the minifier test suite.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 52527bd commit a29bf4b
1 file changed
+10
-22
lines changedLines changed: 10 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
262 | | - | |
263 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
264 | 266 | | |
265 | 267 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
| 268 | + | |
| 269 | + | |
273 | 270 | | |
274 | 271 | | |
275 | 272 | | |
| |||
303 | 300 | | |
304 | 301 | | |
305 | 302 | | |
306 | | - | |
307 | | - | |
| 303 | + | |
308 | 304 | | |
309 | 305 | | |
310 | 306 | | |
311 | 307 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
| 308 | + | |
| 309 | + | |
322 | 310 | | |
323 | 311 | | |
324 | 312 | | |
| |||
0 commit comments