Debian Codegraph @

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

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