From d6fd18d0b000e1e4fbe01259139043f42d8fdebf Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Wed, 13 Nov 2019 04:17:09 +0800 Subject: enhance `evaluate` & `inline` (#3580) --- test/compress/evaluate.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/compress/evaluate.js') diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js index 74cb65ff..ea707e63 100644 --- a/test/compress/evaluate.js +++ b/test/compress/evaluate.js @@ -1900,3 +1900,24 @@ issue_3568: { } expect_stdout: "NaN" } + +conditional_function: { + options = { + evaluate: true, + reduce_vars: true, + toplevel: true, + } + input: { + function f(a) { + return a && "undefined" != typeof A ? A : 42; + } + console.log(f(0), f(1)); + } + expect: { + function f(a) { + return a && "undefined" != typeof A ? A : 42; + } + console.log(42, f(1)); + } + expect_stdout: "42 42" +} -- cgit v1.2.3