diff options
-rw-r--r-- | lib/scope.js | 13 | ||||
-rw-r--r-- | test/compress/ie8.js (renamed from test/compress/screw-ie8.js) | 74 |
2 files changed, 82 insertions, 5 deletions
diff --git a/lib/scope.js b/lib/scope.js index 7cbd82c1..a9431524 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -434,16 +434,19 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options){ var redef = def.redefined(); if (redef) { redefined.push(def); - def.references.forEach(function(ref) { - ref.thedef = redef; - ref.reference(options); - ref.thedef = def; - }); + reference(node.argname); + def.references.forEach(reference); } descend(); if (!redef) mangle(def); return true; } + + function reference(sym) { + sym.thedef = redef; + sym.reference(options); + sym.thedef = def; + } }); this.walk(tw); redefined.forEach(mangle); diff --git a/test/compress/screw-ie8.js b/test/compress/ie8.js index 3a95eb6b..b21b8411 100644 --- a/test/compress/screw-ie8.js +++ b/test/compress/ie8.js @@ -464,3 +464,77 @@ issue_2976_2: { } expect_stdout: "PASS" } + +issue_3035: { + mangle = { + ie8: false, + } + input: { + var c = "FAIL"; + (function(a) { + try { + throw 1; + } catch (b) { + try { + throw 0; + } catch (a) { + b && (c = "PASS"); + } + } + })(); + console.log(c); + } + expect: { + var c = "FAIL"; + (function(o) { + try { + throw 1; + } catch (t) { + try { + throw 0; + } catch (o) { + t && (c = "PASS"); + } + } + })(); + console.log(c); + } + expect_stdout: "PASS" +} + +issue_3035_ie8: { + mangle = { + ie8: true, + } + input: { + var c = "FAIL"; + (function(a) { + try { + throw 1; + } catch (b) { + try { + throw 0; + } catch (a) { + b && (c = "PASS"); + } + } + })(); + console.log(c); + } + expect: { + var c = "FAIL"; + (function(t) { + try { + throw 1; + } catch (o) { + try { + throw 0; + } catch (t) { + o && (c = "PASS"); + } + } + })(); + console.log(c); + } + expect_stdout: "PASS" +} |