aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compress.js1
-rw-r--r--test/compress/reduce_vars.js24
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js
index a8bcf54f..0fac3259 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -674,6 +674,7 @@ merge(Compressor.prototype, {
d.escaped = true;
return;
} else if (parent instanceof AST_Array
+ || parent instanceof AST_Binary && lazy_op(parent.operator)
|| parent instanceof AST_Conditional && node !== parent.condition
|| parent instanceof AST_Sequence && node === parent.tail_node()) {
mark_escaped(d, scope, parent, parent, level + 1);
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 394bb586..bf1155b7 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -4899,3 +4899,27 @@ do_while: {
}
expect_stdout: "PASS"
}
+
+issue_2598: {
+ options = {
+ reduce_funcs: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function f() {}
+ function g(a) {
+ return a || f;
+ }
+ console.log(g(false) === g(null));
+ }
+ expect: {
+ function f() {}
+ function g(a) {
+ return a || f;
+ }
+ console.log(g(false) === g(null));
+ }
+ expect_stdout: "true"
+}