Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
3 // - src/class-elements/productions/cls-decl-multiple-definitions.template
4 /*---
5 description: Valid Static PrivateName (multiple fields definitions)
6 esid: prod-FieldDefinition
7 features: [class-static-fields-private, class, class-fields-public]
8 flags: [generated]
9 includes: [propertyHelper.js]
10 info: |
11 ClassElement :
12 MethodDefinition
13 static MethodDefinition
14 FieldDefinition ;
15 static FieldDefinition ;
16 ;
17
18 FieldDefinition :
19 ClassElementName Initializer _opt
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
51 NOTE 3
52 The sets of code points with Unicode properties "ID_Start" and
53 "ID_Continue" include, respectively, the code points with Unicode
54 properties "Other_ID_Start" and "Other_ID_Continue".
55
56 ---*/
57
58
59 class C {
60 foo = "foobar";
61 m() { return 42 }
62 static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1
63 m2() { return 39 }
64 bar = "barbaz";
65 static $() {
66 return this.#$;
67 }
68 static _() {
69 return this.#_;
70 }
71 static \u{6F}() {
72 return this.#\u{6F};
73 }
74 static ℘() {
75 return this.#℘;
76 }
77 static ZW_‌_NJ() {
78 return this.#ZW_‌_NJ;
79 }
80 static ZW_‍_J() {
81 return this.#ZW_‍_J;
82 }
83 }
84
85 var c = new C();
86
87 assert.sameValue(c.m(), 42);
88 assert(
89 !Object.prototype.hasOwnProperty.call(c, "m"),
90 "m doesn't appear as an own property on the C instance"
91 );
92 assert.sameValue(c.m, C.prototype.m);
93
94 verifyProperty(C.prototype, "m", {
95 enumerable: false,
96 configurable: true,
97 writable: true,
98 });
99
100 assert.sameValue(c.m2(), 39);
101 assert(!
102 Object.prototype.hasOwnProperty.call(c, "m2"),
103 "m2 doesn't appear as an own property on the C instance"
104 );
105 assert.sameValue(c.m2, C.prototype.m2);
106
107 verifyProperty(C.prototype, "m2", {
108 enumerable: false,
109 configurable: true,
110 writable: true,
111 });
112
113 assert.sameValue(c.foo, "foobar");
114 assert(
115 !Object.prototype.hasOwnProperty.call(C, "foo"),
116 "foo doesn't appear as an own property on the C constructor"
117 );
118 assert(
119 !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
120 "foo doesn't appear as an own property on the C prototype"
121 );
122
123 verifyProperty(c, "foo", {
124 value: "foobar",
125 enumerable: true,
126 configurable: true,
127 writable: true,
128 });
129
130 assert.sameValue(c.bar, "barbaz");
131 assert(
132 !Object.prototype.hasOwnProperty.call(C, "bar"),
133 "bar doesn't appear as an own property on the C constructor"
134 );
135 assert(
136 !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
137 "bar doesn't appear as an own property on the C prototype"
138 );
139
140 verifyProperty(c, "bar", {
141 value: "barbaz",
142 enumerable: true,
143 configurable: true,
144 writable: true,
145 });
146
147 assert.sameValue(C.$(), 1);
148 assert.sameValue(C._(), 1);
149 assert.sameValue(C.\u{6F}(), 1);
150 assert.sameValue(C.℘(), 1);
151 assert.sameValue(C.ZW_‌_NJ(), 1);
152 assert.sameValue(C.ZW_‍_J(), 1);
153
154
155 reportCompare(0, 0);