fix corner case in collapse_vars (#3928)

fixes #3927
This commit is contained in:
Alex Lam S.L
2020-05-27 14:02:48 +01:00
committed by GitHub
parent 49ea629f3f
commit 7840746bd9
2 changed files with 35 additions and 1 deletions

View File

@@ -1172,7 +1172,7 @@ merge(Compressor.prototype, {
scope = node;
break;
} else if (node instanceof AST_Try) {
in_try = node;
if (!in_try) in_try = node;
}
} while (node = compressor.parent(level++));
}

View File

@@ -8108,3 +8108,37 @@ issue_3908: {
}
expect_stdout: "PASS"
}
issue_3927: {
options = {
collapse_vars: true,
}
input: {
var a = 0;
console.log(function(b) {
try {
try {
if (a + (b = "PASS", true)) return;
b.p;
} finally {
return b;
}
} catch (e) {
}
}());
}
expect: {
var a = 0;
console.log(function(b) {
try {
try {
if (a + (b = "PASS", true)) return;
b.p;
} finally {
return b;
}
} catch (e) {}
}());
}
expect_stdout: "PASS"
}