Debian Codegraph @

js/src/tests/test262/language/expressions/class/elements/fields-multiple-definitions-static-private-methods-proxy.js

raw
1 // Copyright (C) 2018 Rick Waldron. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: Static private methods not accessible via default Proxy handler
6 esid: prod-FieldDefinition
7 features: [class, class-static-methods-private]
8 info: |
9 ClassElement :
10 ...
11 static FieldDefinition ;
12
13 FieldDefinition :
14 ClassElementName Initializer_opt
15
16 ClassElementName :
17 PrivateName
18
19 PrivateName :
20 # IdentifierName
21
22 ---*/
23
24
25 var C = class {
26 static #x(value) {
27 return 1;
28 }
29 static x() {
30 return this.#x();
31 }
32 }
33
34 var P = new Proxy(C, {});
35
36 assert.sameValue(C.x(), 1);
37 assert.throws(TypeError, function() {
38 P.x();
39 });
40
41 reportCompare(0, 0);