aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-06-12 01:00:19 +0100
committerGitHub <noreply@github.com>2020-06-12 08:00:19 +0800
commita82ca62b66c7c7e1083d9f2195870fbdb1d22361 (patch)
tree90a118e0437082e98bcaecb6e6bf5882de03408d /test/compress
parente9465717abb77fed206455881a983f313d2b894c (diff)
downloadtracifyjs-a82ca62b66c7c7e1083d9f2195870fbdb1d22361.tar.gz
tracifyjs-a82ca62b66c7c7e1083d9f2195870fbdb1d22361.zip
fix corner case in `dead_code` (#3991)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/dead-code.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js
index a2ebf37a..4f731875 100644
--- a/test/compress/dead-code.js
+++ b/test/compress/dead-code.js
@@ -1290,12 +1290,37 @@ self_assignments_5: {
}
expect: {
var i = 0, l = [ "FAIL", "PASS" ];
+ l[0];
+ l[0];
l[0] = l[1];
console.log(l[0], 2);
}
expect_stdout: "PASS 2"
}
+self_assignments_6: {
+ options = {
+ dead_code: true,
+ pure_getters: "strict",
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ }
+ input: {
+ var o = {
+ p: "PASS",
+ };
+ console.log(o.p = o.p);
+ }
+ expect: {
+ var o = {
+ p: "PASS",
+ };
+ console.log(o.p);
+ }
+ expect_stdout: "PASS"
+}
+
issue_3967: {
options = {
dead_code: true,