Debian Codegraph @

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

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