diff --git a/lib/compress.js b/lib/compress.js index 80ace965..6f4d46fc 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -4767,6 +4767,7 @@ Compressor.prototype.compress = function(node) { }); var scan_modified = new TreeWalker(function(node) { if (node instanceof AST_Assign) modified(node.left); + if (node instanceof AST_ForEnumeration) modified(node.init); if (node instanceof AST_Unary && UNARY_POSTFIX[node.operator]) modified(node.expression); }); function modified(node) { diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js index d6e2867d..0f8cfaf6 100644 --- a/test/compress/evaluate.js +++ b/test/compress/evaluate.js @@ -3349,3 +3349,30 @@ issue_5362_2: { } expect_stdout: "true" } + +issue_5380: { + options = { + evaluate: true, + keep_fnames: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var a = function f(b) { + return function g() { + for (b in { PASS: 42 }); + }(), b; + }("FAIL"); + console.log(a); + } + expect: { + var a = function f(b) { + return function g() { + for (b in { PASS: 42 }); + }(), b; + }("FAIL"); + console.log(a); + } + expect_stdout: "PASS" +}