fix corner case in ie8 (#3890)

fixes #3889
This commit is contained in:
Alex Lam S.L
2020-05-12 12:28:29 +01:00
committed by GitHub
parent eb7fa25270
commit 8024f7f7a8
2 changed files with 33 additions and 0 deletions

View File

@@ -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) {

View File

@@ -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"
}