From e7c21e87e3a3d1c9700941ecdf97a2a50fa2ae66 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 1 Aug 2017 02:38:32 +0800 Subject: [PATCH] fix `ie8` mangling of top-level `AST_SymbolCatch` (#2263) fixes #2254 --- lib/scope.js | 1 + test/compress/screw-ie8.js | 66 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/lib/scope.js b/lib/scope.js index df7b2076..8e766a56 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -235,6 +235,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ ref.reference(options); }); node.thedef = def; + node.reference(options); return true; } })); diff --git a/test/compress/screw-ie8.js b/test/compress/screw-ie8.js index 5d6f1e2c..66559b0b 100644 --- a/test/compress/screw-ie8.js +++ b/test/compress/screw-ie8.js @@ -325,3 +325,69 @@ issue_2120_2: { } expect_stdout: "PASS" } + +issue_2254_1: { + mangle = { + ie8: false, + } + input: { + "eeeeee"; + try { + console.log(f("PASS")); + } catch (e) {} + function f(s) { + try { + throw "FAIL"; + } catch (e) { + return s; + } + } + } + expect: { + "eeeeee"; + try { + console.log(f("PASS")); + } catch (e) {} + function f(e) { + try { + throw "FAIL"; + } catch (t) { + return e; + } + } + } + expect_stdout: "PASS" +} + +issue_2254_2: { + mangle = { + ie8: true, + } + input: { + "eeeeee"; + try { + console.log(f("PASS")); + } catch (e) {} + function f(s) { + try { + throw "FAIL"; + } catch (e) { + return s; + } + } + } + expect: { + "eeeeee"; + try { + console.log(f("PASS")); + } catch (e) {} + function f(t) { + try { + throw "FAIL"; + } catch (e) { + return t; + } + } + } + expect_stdout: "PASS" +} -- 2.34.1