aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-12-02 15:46:05 +0800
committerGitHub <noreply@github.com>2017-12-02 15:46:05 +0800
commit77332a03153285f5e521c99c3b5d796bf5698ef7 (patch)
tree8e2eefe6fa5fe317e36d6a2b7e2ae707cc8efdd2 /test/compress
parent85c56adbd19bff5e7bc2a59dd937799b7bc5a8d4 (diff)
downloadtracifyjs-77332a03153285f5e521c99c3b5d796bf5698ef7.tar.gz
tracifyjs-77332a03153285f5e521c99c3b5d796bf5698ef7.zip
fix `dead_code` on `for` (#2552)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/loops.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/compress/loops.js b/test/compress/loops.js
index 44e92c58..3538c221 100644
--- a/test/compress/loops.js
+++ b/test/compress/loops.js
@@ -468,3 +468,27 @@ init_side_effects: {
}
expect_stdout: true
}
+
+dead_code_condition: {
+ options = {
+ dead_code: true,
+ evaluate: true,
+ loops: true,
+ sequences: true,
+ }
+ input: {
+ for (var a = 0, b = 5; (a += 1, 3) - 3 && b > 0; b--) {
+ var c = function() {
+ b--;
+ }(a++);
+ }
+ console.log(a);
+ }
+ expect: {
+ var c;
+ var a = 0, b = 5;
+ a += 1, 0,
+ console.log(a);
+ }
+ expect_stdout: "1"
+}