Skip to content

Commit 8781537

Browse files
committed
fix(minifier): { let foo; const bar = undefined; } -> { let foo, bar; } (#8764)
1 parent 602becd commit 8781537

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/oxc_minifier/src/peephole/normalize.rs

+4
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ impl<'a> Normalize {
161161
if all_declarations_are_only_read {
162162
decl.kind = VariableDeclarationKind::Let;
163163
}
164+
for decl in &mut decl.declarations {
165+
decl.kind = VariableDeclarationKind::Let;
166+
}
164167
}
165168
}
166169

@@ -229,6 +232,7 @@ mod test {
229232
test_same("for (const i = 0; i < 1; i++);");
230233
test_same("for (const x in [1, 2, 3]) x++");
231234
test_same("for (const x of [1, 2, 3]) x++");
235+
test("{ let foo; const bar = undefined; }", "{ let foo, bar; }");
232236
}
233237

234238
#[test]

0 commit comments

Comments
 (0)