From 931ac666382081a80267ab01ecfa5712162d5837 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sun, 6 Oct 2019 10:29:13 +0800 Subject: fix corner case in `hoist_props` (#3452) fixes #3440 --- test/compress/hoist_props.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/compress') diff --git a/test/compress/hoist_props.js b/test/compress/hoist_props.js index b055ae7b..0d8e771a 100644 --- a/test/compress/hoist_props.js +++ b/test/compress/hoist_props.js @@ -886,3 +886,31 @@ issue_3411: { } expect_stdout: "PASS" } + +issue_3440: { + options = { + hoist_props: true, + reduce_vars: true, + unused: true, + } + input: { + (function() { + function f() { + console.log(o.p); + } + var o = { + p: "PASS", + }; + return f; + })()(); + } + expect: { + (function() { + var o_p = "PASS"; + return function() { + console.log(o_p); + }; + })()(); + } + expect_stdout: "PASS" +} -- cgit v1.2.3