From 1988495d712c4eeabd89068b4da3420e2e5eb50f Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 4 Jan 2020 09:24:28 +0800 Subject: fix corner case in `conditionals` (#3669) fixes #3668 --- test/compress/conditionals.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test/compress/conditionals.js') diff --git a/test/compress/conditionals.js b/test/compress/conditionals.js index 3f3df72d..2049b401 100644 --- a/test/compress/conditionals.js +++ b/test/compress/conditionals.js @@ -1578,3 +1578,34 @@ issue_3576: { } expect_stdout: "PASS" } + +issue_3668: { + options = { + conditionals: true, + if_return: true, + } + input: { + function f() { + try { + var undefined = typeof f; + if (!f) return undefined; + return; + } catch (e) { + return "FAIL"; + } + } + console.log(f()); + } + expect: { + function f() { + try { + var undefined = typeof f; + return f ? void 0 : undefined; + } catch (e) { + return "FAIL"; + } + } + console.log(f()); + } + expect_stdout: "undefined" +} -- cgit v1.2.3