fix corner case in dead_code (#4304)

This commit is contained in:
Alex Lam S.L
2020-11-19 00:34:55 +00:00
committed by GitHub
parent db87dcf13e
commit 134ef0b1eb
3 changed files with 39 additions and 1 deletions

View File

@@ -7027,7 +7027,8 @@ merge(Compressor.prototype, {
OPT(AST_Try, function(self, compressor) {
self.body = tighten_body(self.body, compressor);
if (compressor.option("dead_code")) {
if (has_declarations_only(self)) {
if (has_declarations_only(self)
&& !(self.bcatch && self.bcatch.argname && !can_drop_symbol(self.bcatch.argname))) {
var body = [];
if (self.bcatch) {
extract_declarations_from_unreachable_code(compressor, self.bcatch, body);