summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/PrivateName/names.js
blob: 39d5128b2eaf3fd8576b2a68669417a926844f49 (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
// |reftest| 
var C = class {
  static #field = () => 'Test262';
  static field = () => 'Test262';
  #instance = () => 'Test262';
  instance = () => 'Test262';

  static accessPrivateField() {
    return this.#field;
  }

  accessPrivateInstanceField() {
    return this.#instance;
  }

  static accessField() {
    return this.field;
  }

  accessInstanceField() {
    return this.instance;
  }
}
assertEq(C.accessPrivateField().name, '#field')
assertEq(C.accessField().name, 'field');
var c = new C;
assertEq(c.accessPrivateInstanceField().name, '#instance');
assertEq(c.accessInstanceField().name, 'instance');

if (typeof reportCompare === 'function') reportCompare(0, 0);