diff options
-rw-r--r-- | lib/compress.js | 2 | ||||
-rw-r--r-- | test/compress/comparisons.js | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index 595e5032..bcaecb8a 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -7112,7 +7112,7 @@ merge(Compressor.prototype, { && self.right instanceof AST_SymbolRef && self.left.definition() === self.right.definition() && is_object(self.left)) { - return make_node(self.operator[0] == "=" ? AST_True : AST_False, self); + return make_node(self.operator[0] == "=" ? AST_True : AST_False, self).optimize(compressor); } break; case "&&": diff --git a/test/compress/comparisons.js b/test/compress/comparisons.js index f93ccbe1..a04498ee 100644 --- a/test/compress/comparisons.js +++ b/test/compress/comparisons.js @@ -123,6 +123,29 @@ self_comparison_3: { ] } +self_comparison_4: { + options = { + booleans: true, + comparisons: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var o = {}; + console.log(o == o, o != o); + console.log(o === o, o !== o); + } + expect: { + console.log(!0, !1); + console.log(!0, !1); + } + expect_stdout: [ + "true false", + "true false", + ] +} + issue_2857_1: { options = { comparisons: true, |