Debian Codegraph @

js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-getter.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-elements/rs-private-getter.case
3 // - src/class-elements/productions/cls-expr-same-line-method.template
4 /*---
5 description: Valid PrivateName as private getter (field definitions followed by a method in the same line)
6 esid: prod-FieldDefinition
7 features: [class-methods-private, class-fields-private, class, class-fields-public]
8 flags: [generated]
9 includes: [propertyHelper.js]
10 info: |
11 ClassElement :
12 MethodDefinition
13 ...
14 ;
15
16 MethodDefinition :
17 ...
18 get ClassElementName ( ){ FunctionBody }
19 ...
20
21 ClassElementName :
22 PropertyName
23 PrivateName
24
25 PrivateName ::
26 # IdentifierName
27
28 IdentifierName ::
29 IdentifierStart
30 IdentifierName IdentifierPart
31
32 IdentifierStart ::
33 UnicodeIDStart
34 $
35 _
36 \ UnicodeEscapeSequence
37
38 IdentifierPart::
39 UnicodeIDContinue
40 $
41 \ UnicodeEscapeSequence
42 <ZWNJ> <ZWJ>
43
44 UnicodeIDStart::
45 any Unicode code point with the Unicode property "ID_Start"
46
47 UnicodeIDContinue::
48 any Unicode code point with the Unicode property "ID_Continue"
49
50 NOTE 3
51 The sets of code points with Unicode properties "ID_Start" and
52 "ID_Continue" include, respectively, the code points with Unicode
53 properties "Other_ID_Start" and "Other_ID_Continue".
54
55 ---*/
56
57
58 var C = class {
59 #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
60 get #$() {
61 return this.#$_;
62 }
63 get #_() {
64 return this.#__;
65 }
66 get #\u{6F}() {
67 return this.#\u{6F}_;
68 }
69 get #\u2118() {
70 return this.#\u2118_;
71 }
72 get #ZW_\u200C_NJ() {
73 return this.#ZW_\u200C_NJ_;
74 }
75 get #ZW_\u200D_J() {
76 return this.#ZW_\u200D_J_;
77 }
78 ; m() { return 42; }
79 $(value) {
80 this.#$_ = value;
81 return this.#$;
82 }
83 _(value) {
84 this.#__ = value;
85 return this.#_;
86 }
87 \u{6F}(value) {
88 this.#\u{6F}_ = value;
89 return this.#\u{6F};
90 }
91 \u2118(value) {
92 this.#\u2118_ = value;
93 return this.#\u2118;
94 }
95 ZW_\u200C_NJ(value) {
96 this.#ZW_\u200C_NJ_ = value;
97 return this.#ZW_\u200C_NJ;
98 }
99 ZW_\u200D_J(value) {
100 this.#ZW_\u200D_J_ = value;
101 return this.#ZW_\u200D_J;
102 }
103
104 }
105
106 var c = new C();
107
108 assert.sameValue(c.m(), 42);
109 assert.sameValue(c.m, C.prototype.m);
110 assert(
111 !Object.prototype.hasOwnProperty.call(c, "m"),
112 "m doesn't appear as an own property on the C instance"
113 );
114
115 verifyProperty(C.prototype, "m", {
116 enumerable: false,
117 configurable: true,
118 writable: true,
119 });
120
121 assert.sameValue(c.$(1), 1);
122 assert.sameValue(c._(1), 1);
123 assert.sameValue(c.\u{6F}(1), 1);
124 assert.sameValue(c.\u2118(1), 1);
125 assert.sameValue(c.ZW_\u200C_NJ(1), 1);
126 assert.sameValue(c.ZW_\u200D_J(1), 1);
127
128 reportCompare(0, 0);