aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compress.js5
-rw-r--r--test/compress/evaluate.js14
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 49185aec..2803b85c 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2240,7 +2240,10 @@ merge(Compressor.prototype, {
var elements = [];
for (var i = 0, len = this.elements.length; i < len; i++) {
var element = this.elements[i];
- if (element instanceof AST_Function) continue;
+ if (element instanceof AST_Function) {
+ elements.push(element);
+ continue;
+ }
var value = element._eval(compressor, depth);
if (element === value) return this;
elements.push(value);
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index d40880f3..0d26982c 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -1360,3 +1360,17 @@ issue_2535_3: {
"WARN: Condition left of || always true [test/compress/evaluate.js:1341,20]",
]
}
+
+issue_2822: {
+ options = {
+ evaluate: true,
+ unsafe: true,
+ }
+ input: {
+ console.log([ function() {}, "PASS", "FAIL" ][1]);
+ }
+ expect: {
+ console.log("PASS");
+ }
+ expect_stdout: "PASS"
+}