diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-03-03 01:18:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-03 09:18:02 +0800 |
commit | 10ca578ee57a0630c2b59d3da9b2c6e5ec6d476a (patch) | |
tree | df7f6344cc225abdf186cece9ce0fda9b75c2efc /test | |
parent | 955411e0657cbaea3226537b2738307d10754b02 (diff) | |
download | tracifyjs-10ca578ee57a0630c2b59d3da9b2c6e5ec6d476a.tar.gz tracifyjs-10ca578ee57a0630c2b59d3da9b2c6e5ec6d476a.zip |
fix corner case in `inline` (#4726)
fixes #4725
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/classes.js | 54 | ||||
-rw-r--r-- | test/compress/functions.js | 54 |
2 files changed, 108 insertions, 0 deletions
diff --git a/test/compress/classes.js b/test/compress/classes.js index f073acd4..82c6f30e 100644 --- a/test/compress/classes.js +++ b/test/compress/classes.js @@ -1172,3 +1172,57 @@ issue_4722_3: { expect_stdout: "PASS" node_version: ">=10" } + +issue_4725_1: { + options = { + inline: true, + } + input: { + "use strict"; + console.log(typeof new class { + f() { + return function g() { + return g; + }(); + } + }().f()); + } + expect: { + "use strict"; + console.log(typeof new class { + f() { + return function g() { + return g; + }(); + } + }().f()); + } + expect_stdout: "function" + node_version: ">=4" +} + +issue_4725_2: { + options = { + inline: true, + } + input: { + "use strict"; + new class { + f() { + return function() { + while (console.log("PASS")); + }(); + } + }().f(); + } + expect: { + "use strict"; + new class { + f() { + while (console.log("PASS")); + } + }().f(); + } + expect_stdout: "PASS" + node_version: ">=4" +} 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" +} |