From 8b2cfd45fa8dd4f01d9535ad43bc37ce4953e78d Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Mon, 15 Jun 2020 01:29:01 +0800 Subject: fix corner case in `rename` (#4000) fixes #3999 --- test/compress/ie8.js | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'test/compress') diff --git a/test/compress/ie8.js b/test/compress/ie8.js index e11e3651..c0049766 100644 --- a/test/compress/ie8.js +++ b/test/compress/ie8.js @@ -2223,13 +2223,13 @@ issue_3523_rename_ie8: { expect: { var a = 0, b, c = "FAIL"; (function() { - var c, n, t, o, a, r, f, i, u, e, h, l, v, y; + var c, n, t, o, a, r, e, f, i, u, h, l, v, y; })(); try { throw 0; } catch (e) { (function() { - (function n() { + (function e() { c = "PASS"; })(); })(); @@ -2522,3 +2522,40 @@ issue_3918: { } expect_stdout: "PASS" } + +issue_3999: { + rename = true + mangle = { + ie8: true, + } + input: { + (function() { + (function f() { + for (var i = 0; i < 2; i++) + try { + f[0]; + } catch (f) { + var f = 0; + console.log(i); + } + })(); + })(typeof f); + } + expect: { + (function() { + (function f() { + for (var c = 0; c < 2; c++) + try { + f[0]; + } catch (f) { + var f = 0; + console.log(c); + } + })(); + })(typeof f); + } + expect_stdout: [ + "0", + "1", + ] +} -- cgit v1.2.3