aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-04-17 17:24:29 +0800
committerGitHub <noreply@github.com>2017-04-17 17:24:29 +0800
commit6d5f341999da7dfad708979151932fd9d8242ebd (patch)
tree733a86ed60adb6bb78a8caeed03916ad6cd7da74 /test
parent4ffb6fce7668a1199284e4ce8be91fdaeaf2df0e (diff)
downloadtracifyjs-6d5f341999da7dfad708979151932fd9d8242ebd.tar.gz
tracifyjs-6d5f341999da7dfad708979151932fd9d8242ebd.zip
fix `reduce_vars` on boolean binary expressions (#1819)
Side effects of `&&` and `||` have not mattered until #1814, which takes assignment expressions into account.
Diffstat (limited to 'test')
-rw-r--r--test/compress/reduce_vars.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 82b00211..94d37cb7 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -2217,3 +2217,26 @@ try_abort: {
}
expect_stdout: "1 undefined"
}
+
+boolean_binary_assign: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ !function() {
+ var a;
+ void 0 && (a = 1);
+ console.log(a);
+ }();
+ }
+ expect: {
+ !function() {
+ var a;
+ void 0;
+ console.log(a);
+ }();
+ }
+ expect_stdout: "undefined"
+}