stay safe with constants in IE8- (#1547)

- `undefined` etc. can be redefined at top-level for IE8-, so disable related optimisations
- fixed `--support-ie8` catch mangle bug
This commit is contained in:
Alex Lam S.L
2017-03-05 12:51:11 +08:00
committed by GitHub
parent eb98a7f2f3
commit 1f0333e9f1
5 changed files with 52 additions and 20 deletions

View File

@@ -3348,7 +3348,9 @@ merge(Compressor.prototype, {
return def;
}
// testing against !self.scope.uses_with first is an optimization
if (self.undeclared() && !isLHS(self, compressor.parent())
if (compressor.option("screw_ie8")
&& self.undeclared()
&& !isLHS(self, compressor.parent())
&& (!self.scope.uses_with || !compressor.find_parent(AST_With))) {
switch (self.name) {
case "undefined":