summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/fields/super.js
blob: 5031271ab2a4a7e08cfee7dd6541d0a7c431367e (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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);