aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-02-01 19:15:17 +0800
committerGitHub <noreply@github.com>2018-02-01 19:15:17 +0800
commitc3a002ff9739b60ec1836719c1e240df22a67830 (patch)
tree181897bab1377b136aef85dca74f7439d18f06e4 /lib/compress.js
parentfad6766a905350574b698af707958294e22184f3 (diff)
downloadtracifyjs-c3a002ff9739b60ec1836719c1e240df22a67830.tar.gz
tracifyjs-c3a002ff9739b60ec1836719c1e240df22a67830.zip
account for side-effects in `comparisons` of `null` & `undefined` (#2863)
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js
index a88ea2c4..1b0aa15a 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -4800,6 +4800,7 @@ merge(Compressor.prototype, {
&& lhs.operator == self.right.operator
&& (is_undefined(lhs.left, compressor) && self.right.left instanceof AST_Null
|| lhs.left instanceof AST_Null && is_undefined(self.right.left, compressor))
+ && !lhs.right.has_side_effects(compressor)
&& lhs.right.equivalent_to(self.right.right)) {
var combined = make_node(AST_Binary, self, {
operator: lhs.operator.slice(0, -1),