mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(minifier): RemoveDeadCode should visit nested expression (#4268)
This commit is contained in:
parent
8fad7dbac3
commit
f144082a60
2 changed files with 7 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ impl<'a> VisitMut<'a> for RemoveDeadCode<'a> {
|
|||
fn visit_expression(&mut self, expr: &mut Expression<'a>) {
|
||||
self.fold_conditional_expression(expr);
|
||||
self.fold_logical_expression(expr);
|
||||
walk_mut::walk_expression(self, expr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,12 @@ fn dce_if_statement() {
|
|||
",
|
||||
"{foo; return }",
|
||||
);
|
||||
|
||||
// nested expression
|
||||
test(
|
||||
"const a = { fn: function() { if (true) { foo; } } }",
|
||||
"const a = { fn: function() { { foo; } } }",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue