Debian Codegraph @

js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-getter-alt.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-elements/rs-private-getter-alt.case
3 // - src/class-elements/productions/cls-expr-multiple-definitions.template
4 /*---
5 description: Valid PrivateName as private getter (multiple fields definitions)
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 foo = "foobar";
60 m() { return 42 }
61 #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
62 get #$() {
63 return this.#$_;
64 }
65 get #_() {
66 return this.#__;
67 }
68 get #\u{6F}() {
69 return this.#\u{6F}_;
70 }
71 get #℘() {
72 return this.#℘_;
73 }
74 get #ZW_‌_NJ() {
75 return this.#ZW_‌_NJ_;
76 }
77 get #ZW_‍_J() {
78 return this.#ZW_‍_J_;
79 }
80
81 m2() { return 39 }
82 bar = "barbaz";
83 $(value) {
84 this.#$_ = value;
85 return this.#$;
86 }
87 _(value) {
88 this.#__ = value;
89 return this.#_;
90 }
91 \u{6F}(value) {
92 this.#\u{6F}_ = value;
93 return this.#\u{6F};
94 }
95 ℘(value) {
96 this.#℘_ = value;
97 return this.#℘;
98 }
99 ZW_‌_NJ(value) {
100 this.#ZW_‌_NJ_ = value;
101 return this.#ZW_‌_NJ;
102 }
103 ZW_‍_J(value) {
104 this.#ZW_‍_J_ = value;
105 return this.#ZW_‍_J;
106 }
107
108 }
109
110 var c = new C();
111
112 assert.sameValue(c.m(), 42);
113 assert(
114 !Object.prototype.hasOwnProperty.call(c, "m"),
115 "m doesn't appear as an own property on the C instance"
116 );
117 assert.sameValue(c.m, C.prototype.m);
118
119 verifyProperty(C.prototype, "m", {
120 enumerable: false,
121 configurable: true,
122 writable: true,
123 });
124
125 assert.sameValue(c.m2(), 39);
126 assert(
127 !Object.prototype.hasOwnProperty.call(c, "m2"),
128 "m2 doesn't appear as an own property on the C instance"
129 );
130 assert.sameValue(c.m2, C.prototype.m2);
131
132 verifyProperty(C.prototype, "m2", {
133 enumerable: false,
134 configurable: true,
135 writable: true,
136 });
137
138 assert.sameValue(c.foo, "foobar");
139 assert(
140 !Object.prototype.hasOwnProperty.call(C, "foo"),
141 "foo doesn't appear as an own property on the C constructor"
142 );
143 assert(
144 !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
145 "foo doesn't appear as an own property on the C prototype"
146 );
147
148 verifyProperty(c, "foo", {
149 value: "foobar",
150 enumerable: true,
151 configurable: true,
152 writable: true,
153 });
154
155 assert.sameValue(c.bar, "barbaz");
156 assert(
157 !Object.prototype.hasOwnProperty.call(C, "bar"),
158 "bar doesn't appear as an own property on the C constructor"
159 );
160 assert(
161 !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
162 "bar doesn't appear as an own property on the C prototype"
163 );
164
165 verifyProperty(c, "bar", {
166 value: "barbaz",
167 enumerable: true,
168 configurable: true,
169 writable: true,
170 });
171
172 assert.sameValue(c.$(1), 1);
173 assert.sameValue(c._(1), 1);
174 assert.sameValue(c.\u{6F}(1), 1);
175 assert.sameValue(c.℘(1), 1);
176 assert.sameValue(c.ZW_‌_NJ(1), 1);
177 assert.sameValue(c.ZW_‍_J(1), 1);
178
179 reportCompare(0, 0);