From 10ca578ee57a0630c2b59d3da9b2c6e5ec6d476a Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Wed, 3 Mar 2021 01:18:02 +0000 Subject: fix corner case in `inline` (#4726) fixes #4725 --- test/compress/functions.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'test/compress/functions.js') diff --git a/test/compress/functions.js b/test/compress/functions.js index 44e41dff..98dfc4d8 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -5698,3 +5698,57 @@ block_scope_4_compress: { } expect_stdout: "function" } + +issue_4725_1: { + options = { + inline: true, + } + input: { + var o = { + f() { + return function g() { + return g; + }(); + } + }; + console.log(typeof o.f()); + } + expect: { + var o = { + f() { + return function g() { + return g; + }(); + } + }; + console.log(typeof o.f()); + } + expect_stdout: "function" + node_version: ">=4" +} + +issue_4725_2: { + options = { + inline: true, + } + input: { + var o = { + f() { + return function() { + while (console.log("PASS")); + }(); + } + }; + o.f(); + } + expect: { + var o = { + f() { + while (console.log("PASS")); + } + }; + o.f(); + } + expect_stdout: "PASS" + node_version: ">=4" +} -- cgit v1.2.3