fix corner case in switches (#5011)

fixes #5010
This commit is contained in:
Alex Lam S.L
2021-06-15 13:59:53 +01:00
committed by GitHub
parent bf76e35772
commit 21fc8f4630
2 changed files with 27 additions and 1 deletions

View File

@@ -8506,7 +8506,7 @@ merge(Compressor.prototype, {
}));
return make_node(AST_BlockStatement, self, { body: decl }).optimize(compressor);
}
if (exact_match ? !branch.expression.has_side_effects(compressor) : branch === default_branch) {
if (branch === default_branch || branch === exact_match && !branch.expression.has_side_effects(compressor)) {
while (branch = body[body.length - 2]) {
if (branch instanceof AST_Default) break;
if (!has_declarations_only(branch)) break;