@@ -2560,10 +2560,9 @@ merge(Compressor.prototype, {
|
|||||||
fallthrough = !aborts(exact_match);
|
fallthrough = !aborts(exact_match);
|
||||||
}
|
}
|
||||||
while (i < len) extract_declarations_from_unreachable_code(compressor, self.body[i++], decl);
|
while (i < len) extract_declarations_from_unreachable_code(compressor, self.body[i++], decl);
|
||||||
if (body.length == 0) return make_node(AST_BlockStatement, self, {
|
if (body.length > 0) {
|
||||||
body: decl
|
body[0].body = decl.concat(body[0].body);
|
||||||
}).optimize(compressor);
|
}
|
||||||
body[0].body = decl.concat(body[0].body);
|
|
||||||
self.body = body;
|
self.body = body;
|
||||||
}
|
}
|
||||||
while (branch = self.body[self.body.length - 1]) {
|
while (branch = self.body[self.body.length - 1]) {
|
||||||
@@ -2575,9 +2574,11 @@ merge(Compressor.prototype, {
|
|||||||
&& branch.expression.has_side_effects(compressor)) break;
|
&& branch.expression.has_side_effects(compressor)) break;
|
||||||
self.body.pop();
|
self.body.pop();
|
||||||
}
|
}
|
||||||
if (compressor.option("conditionals") && self.body.length == 0) {
|
if (decl && self.body.length == 0) {
|
||||||
return make_node(AST_SimpleStatement, self, {
|
return make_node(AST_BlockStatement, self, {
|
||||||
body: self.expression
|
body: decl.concat(make_node(AST_SimpleStatement, self.expression, {
|
||||||
|
body: self.expression
|
||||||
|
}))
|
||||||
}).optimize(compressor);
|
}).optimize(compressor);
|
||||||
}
|
}
|
||||||
if (body && body.length == 1 && (body[0] === exact_match || body[0] === default_branch)) {
|
if (body && body.length == 1 && (body[0] === exact_match || body[0] === default_branch)) {
|
||||||
|
|||||||
@@ -553,3 +553,29 @@ issue_1680_2: {
|
|||||||
}
|
}
|
||||||
expect_stdout: true
|
expect_stdout: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_1690_1: {
|
||||||
|
options = {
|
||||||
|
dead_code: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
switch (console.log("PASS")) {}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_1690_2: {
|
||||||
|
options = {
|
||||||
|
dead_code: false,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
switch (console.log("PASS")) {}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
switch (console.log("PASS")) {}
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user