fix corner case in merge_vars (#4256)

fixes #4255
This commit is contained in:
Alex Lam S.L
2020-11-01 06:34:07 +00:00
committed by GitHub
parent cbf7269296
commit 68091dbf69
2 changed files with 29 additions and 2 deletions

View File

@@ -4542,7 +4542,7 @@ merge(Compressor.prototype, {
}
if (node instanceof AST_LabeledStatement) {
push();
segment.block = node.body;
segment.block = node;
node.body.walk(tw);
pop();
return true;
@@ -4737,7 +4737,12 @@ merge(Compressor.prototype, {
function insert(target) {
var stack = [];
while (!HOP(segment, "block") || segment.block !== target) {
while (true) {
if (HOP(segment, "block")) {
var block = segment.block;
if (block instanceof AST_LabeledStatement) block = block.body;
if (block === target) break;
}
stack.push(segment);
pop();
}