aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-03 04:45:20 +0800
committerGitHub <noreply@github.com>2017-03-03 04:45:20 +0800
commit17b81350d46e369588523b421d4528212f0f3207 (patch)
treefce7fd03f9bf7e247b0a61f1b8c481be1dc9f810 /test
parent4d63d4f5b30d2b46f3b6ed4cfced277f4f8e428f (diff)
downloadtracifyjs-17b81350d46e369588523b421d4528212f0f3207.tar.gz
tracifyjs-17b81350d46e369588523b421d4528212f0f3207.zip
fix chained assignment with `unused` (#1540)
When #1450 optimises `a=b=42`, it stops after the first variable even if both are unused. fixes #1539
Diffstat (limited to 'test')
-rw-r--r--test/compress/drop-unused.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index c1ca1b55..4b613181 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -679,3 +679,24 @@ const_assign: {
}
}
}
+
+issue_1539: {
+ options = {
+ cascade: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ function f() {
+ var a, b;
+ a = b = 42;
+ return a;
+ }
+ }
+ expect: {
+ function f() {
+ return 42;
+ }
+ }
+}