From: Alex Lam S.L Date: Tue, 12 May 2020 11:28:29 +0000 (+0100) Subject: fix corner case in `ie8` (#3890) X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=8024f7f7a86023cf68f1f1b2496ec38c8bc200d8;p=UglifyJS.git fix corner case in `ie8` (#3890) fixes #3889 --- diff --git a/lib/compress.js b/lib/compress.js index e4f75899..c34c7630 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -399,6 +399,10 @@ merge(Compressor.prototype, { } }); }; + if (compressor.option("ie8")) scope.variables.each(function(def) { + var d = def.orig[0].definition(); + if (d !== def) d.fixed = false; + }); } function mark_defun(tw, def) { diff --git a/test/compress/ie8.js b/test/compress/ie8.js index 53f78f1b..68ccab17 100644 --- a/test/compress/ie8.js +++ b/test/compress/ie8.js @@ -2460,3 +2460,32 @@ issue_3825: { } expect_stdout: "undefined" } + +issue_3889: { + options = { + evaluate: true, + ie8: true, + reduce_vars: true, + } + input: { + function f(a) { + a = 0; + (function a() { + var a; + console.log(a); + })(); + } + f(); + } + expect: { + function f(a) { + a = 0; + (function a() { + var a; + console.log(a); + })(); + } + f(); + } + expect_stdout: "undefined" +}