From 24917e7084a9ce240660f8d4b69dcbf1515af084 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Wed, 13 Jan 2021 14:17:24 +0000 Subject: fix corner case in `evaluate` (#4553) fixes #4552 --- test/compress/evaluate.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test') diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js index 73c982f2..2b1bbc01 100644 --- a/test/compress/evaluate.js +++ b/test/compress/evaluate.js @@ -3142,3 +3142,36 @@ issue_4480: { } expect_stdout: "PASS" } + +issue_4552: { + options = { + evaluate: true, + keep_fnames: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var a = function f(b) { + return function() { + b++; + try { + return b; + } catch (e) {} + }(); + }(); + console.log(a); + } + expect: { + var a = function f(b) { + return function() { + b++; + try { + return b; + } catch (e) {} + }(); + }(); + console.log(a); + } + expect_stdout: "NaN" +} -- cgit v1.2.3