aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/compress.js b/lib/compress.js
index f4048991..efdb49fe 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1414,11 +1414,18 @@ merge(Compressor.prototype, {
body: self.expression
}).transform(compressor);
}
- var last_branch = self.body[self.body.length - 1];
- if (last_branch) {
- var stat = last_branch.body[last_branch.body.length - 1]; // last statement
- if (stat instanceof AST_Break && loop_body(compressor.loopcontrol_target(stat.label)) === self)
- last_branch.body.pop();
+ for(;;) {
+ var last_branch = self.body[self.body.length - 1];
+ if (last_branch) {
+ var stat = last_branch.body[last_branch.body.length - 1]; // last statement
+ if (stat instanceof AST_Break && loop_body(compressor.loopcontrol_target(stat.label)) === self)
+ last_branch.body.pop();
+ if (last_branch instanceof AST_Default && last_branch.body.length == 0) {
+ self.body.pop();
+ continue;
+ }
+ }
+ break;
}
var exp = self.expression.evaluate(compressor);
out: if (exp.length == 2) try {