aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-11-08 13:45:28 +0800
committerGitHub <noreply@github.com>2019-11-08 13:45:28 +0800
commit10648c9af66364697f0f51219b0497fdfcb6dd34 (patch)
treeb4f2864c7c984a9e8723bcd161114118a82f8d81 /test/compress
parent87e67ec29958a4167d5c202ae3a0fe4be1e10faf (diff)
downloadtracifyjs-10648c9af66364697f0f51219b0497fdfcb6dd34.tar.gz
tracifyjs-10648c9af66364697f0f51219b0497fdfcb6dd34.zip
enhance `dead_code` (#3575)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/dead-code.js38
1 files changed, 38 insertions, 0 deletions
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"
+}