aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
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 /lib/compress.js
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 'lib/compress.js')
-rw-r--r--lib/compress.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 7324fe0e..f49dd60e 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -340,6 +340,14 @@ merge(Compressor.prototype, {
});
}
}
+ if (node instanceof AST_Binary
+ && (node.operator == "&&" || node.operator == "||")) {
+ node.left.walk(tw);
+ push();
+ node.right.walk(tw);
+ pop();
+ return true;
+ }
if (node instanceof AST_If) {
node.condition.walk(tw);
push();