Debian Codegraph @

js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/class-elements/rs-privatename-identifier.case
4 // - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template
5 /*---
6 description: Valid PrivateName (field definitions after a static async generator in the same line)
7 esid: prod-FieldDefinition
8 features: [class-fields-private, class, class-fields-public, async-iteration]
9 flags: [generated, async]
10 includes: [propertyHelper.js]
11 info: |
12 ClassElement :
13 MethodDefinition
14 static MethodDefinition
15 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 var C = class {
60 static async *m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;
61 $(value) {
62 this.#$ = value;
63 return this.#$;
64 }
65 _(value) {
66 this.#_ = value;
67 return this.#_;
68 }
69 \u{6F}(value) {
70 this.#\u{6F} = value;
71 return this.#\u{6F};
72 }
73 \u2118(value) {
74 this.#\u2118 = value;
75 return this.#\u2118;
76 }
77 ZW_\u200C_NJ(value) {
78 this.#ZW_\u200C_NJ = value;
79 return this.#ZW_\u200C_NJ;
80 }
81 ZW_\u200D_J(value) {
82 this.#ZW_\u200D_J = value;
83 return this.#ZW_\u200D_J;
84 }
85 }
86
87 var c = new C();
88
89 assert(
90 !Object.prototype.hasOwnProperty.call(c, "m"),
91 "m doesn't appear as an own property on the C instance"
92 );
93 assert(
94 !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
95 "m doesn't appear as an own property on the C prototype"
96 );
97
98 verifyProperty(C, "m", {
99 enumerable: false,
100 configurable: true,
101 writable: true,
102 }, {restore: true});
103
104 C.m().next().then(function(v) {
105 assert.sameValue(v.value, 42);
106 assert.sameValue(v.done, true);
107
108 function assertions() {
109 // Cover $DONE handler for async cases.
110 function $DONE(error) {
111 if (error) {
112 throw new Test262Error('Test262:AsyncTestFailure')
113 }
114 }
115 assert.sameValue(c.$(1), 1);
116 assert.sameValue(c._(1), 1);
117 assert.sameValue(c.\u{6F}(1), 1);
118 assert.sameValue(c.\u2118(1), 1);
119 assert.sameValue(c.ZW_\u200C_NJ(1), 1);
120 assert.sameValue(c.ZW_\u200D_J(1), 1);
121
122 }
123
124 return Promise.resolve(assertions());
125 }).then($DONE, $DONE);