diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/fields/super.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/fields/super.js')
-rw-r--r-- | js/src/jit-test/tests/fields/super.js | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/fields/super.js b/js/src/jit-test/tests/fields/super.js new file mode 100644 index 0000000000..5031271ab2 --- /dev/null +++ b/js/src/jit-test/tests/fields/super.js @@ -0,0 +1,76 @@ +class Base { +} + +class C extends Base { + field; +} +let c = new C(); +assertEq(true, "field" in c); + +var D = class extends Base { + field; +}; +let d = new D(); +assertEq(true, "field" in d); + +class E extends Base { + field; + constructor() { + super(); + } +}; +let e = new E(); +assertEq(true, "field" in e); + +class F extends Base { + constructor() { + super(); + } + field; +}; +let f = new F(); +assertEq(true, "field" in f); + +class G extends Base { + field2 = 2; + constructor() { + super(); + } + field3 = 3; +}; +let g = new G(); +assertEq(2, g.field2); +assertEq(3, g.field3); + +class H extends Base { + field = 2; + constructor() { + eval("super()"); + } +}; +let h = new H(); +assertEq(2, h.field); + +class I extends Base { + field = 2; + constructor() { + class Tmp { + field = 10; + [super()]; + } + } +}; +let i = new I(); +assertEq(2, i.field); + +class J extends Base { + field = 2; + constructor() { + class Tmp { + field = 10; + [super()](){} + } + } +}; +let j = new J(); +assertEq(2, j.field); |