summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/class/bug1720032-1.js
blob: 34e936c69be8191327496ba5b28c646b58f8800d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// |jit-test| skip-if: getBuildConfiguration("osx") && getBuildConfiguration("arm64")
load(libdir + "asserts.js");
function main() {
  class Base {}

  class Derived extends Base {
    constructor() {
      super();

      let v = 0xffff;

      try {
        // Ensure this statement doesn't get DCE'ed.
        v &= 0xff;

        // Returning a primitive value throws.
        return 0;
      } catch {}

      assertEq(v, 255);
    }
  }

  for (let i = 0; i < 15; i++) {
    assertThrowsInstanceOf(() => new Derived(), TypeError);
  }
}
main();
main();