From 3e2c51a4da6fa27733b666f7db56d7ff7539fba0 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 5 Nov 2019 18:15:28 +0800 Subject: enhance `collapse_vars` (#3572) --- test/compress/collapse_vars.js | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'test/compress') diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 31978c29..cf4e45a5 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -6387,3 +6387,51 @@ issue_3562: { } expect_stdout: "PASS PASS" } + +dot_throw_assign_sequence: { + options = { + collapse_vars: true, + } + input: { + var a = "FAIL"; + try { + var b; + b[0] = (a = "PASS", 0); + a = 1 + a; + } catch (c) { + } + console.log(a); + } + expect: { + var a = "FAIL"; + try { + var b; + b[0] = (a = "PASS", 0); + a = 1 + a; + } catch (c) { + } + console.log(a); + } + expect_stdout: "PASS" +} + +call_assign_order: { + options = { + collapse_vars: true, + } + input: { + var a, b = 1, c = 0, log = console.log; + (function() { + a = b = "PASS"; + })((b = "FAIL", c++)); + log(a, b); + } + expect: { + var a, b = 1, c = 0, log = console.log; + (function() { + a = b = "PASS"; + })((b = "FAIL", c++)); + log(a, b); + } + expect_stdout: "PASS PASS" +} -- cgit v1.2.3