fix do{...}while(false)

This commit is contained in:
alexlamsl 2017-04-21 18:24:54 +08:00
parent 068c141b2a
commit b002aaed87
2 changed files with 19 additions and 1 deletions

View File

@ -2404,7 +2404,8 @@ merge(Compressor.prototype, {
if (node instanceof AST_LoopControl && tw.loopcontrol_target(node) === self) if (node instanceof AST_LoopControl && tw.loopcontrol_target(node) === self)
return has_loop_control = true; return has_loop_control = true;
}); });
self.walk(tw); var parent = compressor.parent();
(parent instanceof AST_LabeledStatement ? parent : self).walk(tw);
if (!has_loop_control) return self.body; if (!has_loop_control) return self.body;
} }
} }

View File

@ -101,3 +101,20 @@ iife_while: {
}(); }();
} }
} }
label_do: {
options = {
evaluate: true,
loops: true,
}
input: {
L: do {
continue L;
} while (0);
}
expect: {
L: do {
continue L;
} while (0);
}
}