Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
4 // - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
5 /*---
6 description: Valid Static GeneratorMethod PrivateName (field definitions after an async generator in the same line)
7 esid: prod-FieldDefinition
8 features: [class-static-methods-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 static FieldDefinition ;
17 ;
18
19 MethodDefinition :
20 GeneratorMethod
21
22 GeneratorMethod :
23 * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
24
25 ClassElementName :
26 PropertyName
27 PrivateName
28
29 PrivateName ::
30 # IdentifierName
31
32 IdentifierName ::
33 IdentifierStart
34 IdentifierName IdentifierPart
35
36 IdentifierStart ::
37 UnicodeIDStart
38 $
39 _
40 \ UnicodeEscapeSequence
41
42 IdentifierPart::
43 UnicodeIDContinue
44 $
45 \ UnicodeEscapeSequence
46 <ZWNJ> <ZWJ>
47
48 UnicodeIDStart::
49 any Unicode code point with the Unicode property "ID_Start"
50
51 UnicodeIDContinue::
52 any Unicode code point with the Unicode property "ID_Continue"
53
54
55 NOTE 3
56 The sets of code points with Unicode properties "ID_Start" and
57 "ID_Continue" include, respectively, the code points with Unicode
58 properties "Other_ID_Start" and "Other_ID_Continue".
59
60 ---*/
61
62
63 class C {
64 async *m() { return 42; } static * #$(value) {
65 yield * value;
66 }
67 static * #_(value) {
68 yield * value;
69 }
70 static * #o(value) {
71 yield * value;
72 }
73 static * #℘(value) {
74 yield * value;
75 }
76 static * #ZW_‌_NJ(value) {
77 yield * value;
78 }
79 static * #ZW_‍_J(value) {
80 yield * value;
81 };
82 static get $() {
83 return this.#$;
84 }
85 static get _() {
86 return this.#_;
87 }
88 static get o() {
89 return this.#o;
90 }
91 static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
92 return this.#℘;
93 }
94 static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
95 return this.#ZW_‌_NJ;
96 }
97 static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
98 return this.#ZW_‍_J;
99 }
100
101 }
102
103 var c = new C();
104
105 assert(
106 !Object.prototype.hasOwnProperty.call(c, "m"),
107 "m doesn't appear as an own property on the C instance"
108 );
109 assert.sameValue(c.m, C.prototype.m);
110
111 verifyProperty(C.prototype, "m", {
112 enumerable: false,
113 configurable: true,
114 writable: true,
115 }, {restore: true});
116
117 c.m().next().then(function(v) {
118 assert.sameValue(v.value, 42);
119 assert.sameValue(v.done, true);
120
121 function assertions() {
122 // Cover $DONE handler for async cases.
123 function $DONE(error) {
124 if (error) {
125 throw new Test262Error('Test262:AsyncTestFailure')
126 }
127 }
128 assert.sameValue(C.$([1]).next().value, 1);
129 assert.sameValue(C._([1]).next().value, 1);
130 assert.sameValue(C.o([1]).next().value, 1);
131 assert.sameValue(C.℘([1]).next().value, 1);
132 assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
133 assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
134 }
135
136 return Promise.resolve(assertions());
137 }).then($DONE, $DONE);