Skip to content

Commit 314f970

Browse files
committed
feat(minifier): remove unused -1n (#12235)
ref: evanw/esbuild@f4159a7
1 parent 95b13e8 commit 314f970

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/oxc_minifier/src/peephole/remove_unused_expression.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'a> PeepholeOptimizations {
5858
self.remove_unused_expression(e, state, ctx)
5959
}
6060
}
61-
_ => false,
61+
_ => !e.may_have_side_effects(ctx),
6262
}
6363
}
6464

@@ -768,6 +768,8 @@ mod test {
768768
test_same("delete x.y");
769769
test_same("delete x.y.z()");
770770
test_same("+0n"); // Uncaught TypeError: Cannot convert a BigInt value to a number
771+
test("-0n", "");
772+
test("-1n", "");
771773
}
772774

773775
#[test]

0 commit comments

Comments
 (0)