diff --git a/lib/compress.js b/lib/compress.js index 46b59b92..da9034f2 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -12818,7 +12818,6 @@ Compressor.prototype.compress = function(node) { left: make_node(AST_Number, node, { value: 0 }), right: make_node(AST_Number, node, { value: 0 }), }); - if (node instanceof AST_Scope && node !== scope) return node; })); var body = []; if (fn.rest || !all(fn.argnames, function(argname) { diff --git a/test/compress/functions.js b/test/compress/functions.js index 02735195..c31d2823 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -7103,3 +7103,35 @@ issue_5230: { } expect_stdout: "42" } + +issue_5237: { + options = { + evaluate: true, + inline: true, + } + input: { + function f() { + (function() { + while (console.log(0/0)); + })(); + (function() { + var NaN = console && console.log(NaN); + })(); + } + f(); + } + expect: { + function f() { + (function() { + while (console.log(0/0)); + })(); + var NaN = console && console.log(NaN); + return; + } + f(); + } + expect_stdout: [ + "NaN", + "undefined", + ] +}