diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-03-02 19:32:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-03 03:32:58 +0800 |
commit | 955411e0657cbaea3226537b2738307d10754b02 (patch) | |
tree | 6580fa1e3502f744d271978c3ef412cfe73521c5 /test | |
parent | adcafce04852bb4730e3e699dfdd656dc018cd0f (diff) | |
download | tracifyjs-955411e0657cbaea3226537b2738307d10754b02.tar.gz tracifyjs-955411e0657cbaea3226537b2738307d10754b02.zip |
fix corner cases with `class` (#4723)
fixes #4720
fixes #4721
fixes #4722
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/classes.js | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/test/compress/classes.js b/test/compress/classes.js index 279cff65..f073acd4 100644 --- a/test/compress/classes.js +++ b/test/compress/classes.js @@ -1047,3 +1047,128 @@ issue_4705: { expect_stdout: "PASS" node_version: ">=12" } + +issue_4720: { + options = { + ie8: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + class A { + static p = function f() {}; + } + console.log(typeof A.p, typeof f); + } + expect: { + class A { + static p = function f() {}; + } + console.log(typeof A.p, typeof f); + } + expect_stdout: "function undefined" + node_version: ">=12" +} + +issue_4721: { + options = { + side_effects: true, + } + input: { + "use strict"; + var a = "foo"; + try { + (class extends 42 { + [a = "bar"]() {} + }) + } catch (e) { + console.log(a); + } + } + expect: { + "use strict"; + var a = "foo"; + try { + (class extends 42 { + [a = "bar"]() {} + }); + } catch (e) { + console.log(a); + } + } + expect_stdout: true + node_version: ">=4" +} + +issue_4722_1: { + options = { + side_effects: true, + } + input: { + "use strict"; + try { + (class extends function*() {} {}); + } catch (e) { + console.log("PASS"); + } + } + expect: { + "use strict"; + try { + (class extends function*() {} {}); + } catch (e) { + console.log("PASS"); + } + } + expect_stdout: "PASS" + node_version: ">=4" +} + +issue_4722_2: { + options = { + side_effects: true, + } + input: { + "use strict"; + try { + (class extends async function() {} {}); + } catch (e) { + console.log("PASS"); + } + } + expect: { + "use strict"; + try { + (class extends async function() {} {}); + } catch (e) { + console.log("PASS"); + } + } + expect_stdout: "PASS" + node_version: ">=8" +} + +issue_4722_3: { + options = { + side_effects: true, + } + input: { + "use strict"; + try { + (class extends async function*() {} {}); + } catch (e) { + console.log("PASS"); + } + } + expect: { + "use strict"; + try { + (class extends async function*() {} {}); + } catch (e) { + console.log("PASS"); + } + } + expect_stdout: "PASS" + node_version: ">=10" +} |