summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/class/bug1720032-2.js
blob: 7ca7a8df06d79b14d1229808e7e07f649852fcd1 (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
function main() {
  class Base {}

  class Derived extends Base {
    constructor() {
      let v = 0xffff;

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

        // Accessing |this| throws when |super()| wasn't yet called.
        this;
      } catch {}

      assertEq(v, 255);

      super();
    }
  }

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