diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-02-10 15:41:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-10 23:41:00 +0800 |
commit | 083679bcad5711a90e49272e8a695a0c7b189a47 (patch) | |
tree | 41cc79a5f16a3fdb55c2856e5b4831e9c0ba46e9 /test | |
parent | f5659f292b796539a0960887f601b3f08c856bb7 (diff) | |
download | tracifyjs-083679bcad5711a90e49272e8a695a0c7b189a47.tar.gz tracifyjs-083679bcad5711a90e49272e8a695a0c7b189a47.zip |
fix corner cases with asynchronous generators (#4642)
fixes #4641
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/collapse_vars.js | 1 | ||||
-rw-r--r-- | test/compress/reduce_vars.js | 1 | ||||
-rw-r--r-- | test/compress/yields.js | 61 |
3 files changed, 63 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 04df8e11..fe963b4a 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -5879,6 +5879,7 @@ collapse_rhs_this: { collapse_rhs_undefined: { options = { collapse_vars: true, + side_effects: true, } input: { var a, b; diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index 185a39cf..5ae0884b 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -2460,6 +2460,7 @@ delay_def: { evaluate: true, reduce_funcs: true, reduce_vars: true, + side_effects: true, unused: true, } input: { diff --git a/test/compress/yields.js b/test/compress/yields.js index 78a5389a..eac47e22 100644 --- a/test/compress/yields.js +++ b/test/compress/yields.js @@ -889,3 +889,64 @@ issue_4639_2: { expect_stdout: "undefined" node_version: ">=4" } + +issue_4641_1: { + options = { + sequences: true, + } + input: { + console.log(typeof async function*() { + try { + console.log("foo"); + return; + } finally { + console.log("bar"); + } + }().next().then); + } + expect: { + console.log(typeof async function*() { + try { + console.log("foo"); + return; + } finally { + console.log("bar"); + } + }().next().then); + } + expect_stdout: [ + "foo", + "bar", + "function", + ] + node_version: ">=10" +} + +issue_4641_2: { + options = { + side_effects: true, + } + input: { + console.log(typeof async function*() { + try { + return void "FAIL"; + } finally { + console.log("PASS"); + } + }().next().then); + } + expect: { + console.log(typeof async function*() { + try { + return void 0; + } finally { + console.log("PASS"); + } + }().next().then); + } + expect_stdout: [ + "function", + "PASS", + ] + node_version: ">=10" +} |