From 10648c9af66364697f0f51219b0497fdfcb6dd34 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 8 Nov 2019 13:45:28 +0800 Subject: enhance `dead_code` (#3575) --- test/compress/dead-code.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test') diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js index 93fc9f41..abc7384d 100644 --- a/test/compress/dead-code.js +++ b/test/compress/dead-code.js @@ -1064,3 +1064,41 @@ issue_3552: { } expect_stdout: "PASS" } + +unreachable_assign: { + options = { + dead_code: true, + } + input: { + console.log(A = "P" + (A = "A" + (B = "S" + (A = B = "S"))), A, B); + } + expect: { + console.log(A = "P" + "A" + (B = "S" + "S"), A, B); + } + expect_stdout: "PASS PASS SS" +} + +catch_return_assign: { + options = { + dead_code: true, + } + input: { + console.log(function() { + try { + throw "FAIL"; + } catch (e) { + return e = "PASS"; + } + }()); + } + expect: { + console.log(function() { + try { + throw "FAIL"; + } catch (e) { + return "PASS"; + } + }()); + } + expect_stdout: "PASS" +} -- cgit v1.2.3