@@ -3331,14 +3331,11 @@ merge(Compressor.prototype, {
33313331 var stat = statements[i];
33323332 if (stat instanceof AST_LoopControl) {
33333333 var lct = compressor.loopcontrol_target(stat);
3334- if (stat instanceof AST_Break
3335- && !(lct instanceof AST_IterationStatement)
3336- && loop_body(lct) === self
3337- || stat instanceof AST_Continue
3338- && loop_body(lct) === self) {
3339- if (stat.label) remove(stat.label.thedef.references, stat);
3340- } else {
3334+ if (loop_body(lct) !== self
3335+ || stat instanceof AST_Break && lct instanceof AST_IterationStatement) {
33413336 statements[n++] = stat;
3337+ } else if (stat.label) {
3338+ remove(stat.label.thedef.references, stat);
33423339 }
33433340 } else {
33443341 statements[n++] = stat;
@@ -5485,6 +5482,21 @@ merge(Compressor.prototype, {
54855482 return compressor.option("unused") && self.label.references.length == 0 ? self.body : self;
54865483 });
54875484
5485+ OPT(AST_LoopControl, function(self, compressor) {
5486+ if (!compressor.option("dead_code")) return self;
5487+ var label = self.label;
5488+ if (label) {
5489+ var lct = compressor.loopcontrol_target(self);
5490+ self.label = null;
5491+ if (compressor.loopcontrol_target(self) === lct) {
5492+ remove(label.thedef.references, self);
5493+ } else {
5494+ self.label = label;
5495+ }
5496+ }
5497+ return self;
5498+ });
5499+
54885500 OPT(AST_Block, function(self, compressor) {
54895501 self.body = tighten_body(self.body, compressor);
54905502 return self;
0 commit comments