Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-elements/rs-privatename-identifier-initializer.case
3 // - src/class-elements/productions/cls-expr-multiple-definitions.template
4 /*---
5 description: Valid PrivateName (multiple fields definitions)
6 esid: prod-FieldDefinition
7 features: [class-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 ;
16
17 FieldDefinition :
18 ClassElementName Initializer _opt
19
20 ClassElementName :
21 PropertyName
22 PrivateName
23
24 PrivateName ::
25 # IdentifierName
26
27 IdentifierName ::
28 IdentifierStart
29 IdentifierName IdentifierPart
30
31 IdentifierStart ::
32 UnicodeIDStart
33 $
34 _
35 \ UnicodeEscapeSequence
36
37 IdentifierPart::
38 UnicodeIDContinue
39 $
40 \ UnicodeEscapeSequence
41 <ZWNJ> <ZWJ>
42
43 UnicodeIDStart::
44 any Unicode code point with the Unicode property "ID_Start"
45
46 UnicodeIDContinue::
47 any Unicode code point with the Unicode property "ID_Continue"
48
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 #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1
62 m2() { return 39 }
63 bar = "barbaz";
64 $() {
65 return this.#$;
66 }
67 _() {
68 return this.#_;
69 }
70 \u{6F}() {
71 return this.#\u{6F};
72 }
73 \u2118() {
74 return this.#\u2118;
75 }
76 ZW_\u200C_NJ() {
77 return this.#ZW_\u200C_NJ;
78 }
79 ZW_\u200D_J() {
80 return this.#ZW_\u200D_J;
81 }
82 }
83
84 var c = new C();
85
86 assert.sameValue(c.m(), 42);
87 assert(
88 !Object.prototype.hasOwnProperty.call(c, "m"),
89 "m doesn't appear as an own property on the C instance"
90 );
91 assert.sameValue(c.m, C.prototype.m);
92
93 verifyProperty(C.prototype, "m", {
94 enumerable: false,
95 configurable: true,
96 writable: true,
97 });
98
99 assert.sameValue(c.m2(), 39);
100 assert(
101 !Object.prototype.hasOwnProperty.call(c, "m2"),
102 "m2 doesn't appear as an own property on the C instance"
103 );
104 assert.sameValue(c.m2, C.prototype.m2);
105
106 verifyProperty(C.prototype, "m2", {
107 enumerable: false,
108 configurable: true,
109 writable: true,
110 });
111
112 assert.sameValue(c.foo, "foobar");
113 assert(
114 !Object.prototype.hasOwnProperty.call(C, "foo"),
115 "foo doesn't appear as an own property on the C constructor"
116 );
117 assert(
118 !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
119 "foo doesn't appear as an own property on the C prototype"
120 );
121
122 verifyProperty(c, "foo", {
123 value: "foobar",
124 enumerable: true,
125 configurable: true,
126 writable: true,
127 });
128
129 assert.sameValue(c.bar, "barbaz");
130 assert(
131 !Object.prototype.hasOwnProperty.call(C, "bar"),
132 "bar doesn't appear as an own property on the C constructor"
133 );
134 assert(
135 !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
136 "bar doesn't appear as an own property on the C prototype"
137 );
138
139 verifyProperty(c, "bar", {
140 value: "barbaz",
141 enumerable: true,
142 configurable: true,
143 writable: true,
144 });
145
146 assert.sameValue(c.$(), 1);
147 assert.sameValue(c._(), 1);
148 assert.sameValue(c.\u{6F}(), 1);
149 assert.sameValue(c.\u2118(), 1);
150 assert.sameValue(c.ZW_\u200C_NJ(), 1);
151 assert.sameValue(c.ZW_\u200D_J(), 1);
152
153
154 reportCompare(0, 0);