From d66d86f20bc231bd8d305ee5ba05efa77aa8b6be Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Thu, 8 Feb 2018 03:31:51 +0800 Subject: account for exceptions in `AST_Assign.left` (#2892) fixes #2891 --- test/compress/collapse_vars.js | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'test') diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 19db6058..ed1d8d97 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -4461,3 +4461,59 @@ issue_2878: { } expect_stdout: "1" } + +issue_2891_1: { + options = { + collapse_vars: true, + } + input: { + var a = "PASS", b; + try { + b = c.p = 0; + a = "FAIL"; + b(); + } catch (e) { + } + console.log(a); + } + expect: { + var a = "PASS", b; + try { + b = c.p = 0; + a = "FAIL"; + b(); + } catch (e) { + } + console.log(a); + } + expect_stdout: "PASS" +} + +issue_2891_2: { + options = { + collapse_vars: true, + } + input: { + "use strict"; + var a = "PASS", b; + try { + b = c = 0; + a = "FAIL"; + b(); + } catch (e) { + } + console.log(a); + } + expect: { + "use strict"; + var a = "PASS", b; + try { + b = c = 0; + a = "FAIL"; + b(); + } catch (e) { + } + console.log(a); + } + expect_stdout: true +} -- cgit v1.2.3