Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-literal-names.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/class-elements/literal-names.case
4 // - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
5 /*---
6 description: Literal property names (field definitions after a static async generator in the same line)
7 esid: prod-FieldDefinition
8 features: [class-fields-public, class, async-iteration]
9 flags: [generated, async]
10 includes: [propertyHelper.js]
11 info: |
12 ClassElement:
13 ...
14 FieldDefinition ;
15
16 FieldDefinition:
17 ClassElementName Initializer_opt
18
19 ClassElementName:
20 PropertyName
21
22 ---*/
23 const fn = function() {}
24
25
26
27 class C {
28 static async *m() { return 42; } a; b = 42;
29 c = fn;
30
31 }
32
33 var c = new C();
34
35 assert(
36 !Object.prototype.hasOwnProperty.call(c, "m"),
37 "m doesn't appear as an own property on the C instance"
38 );
39 assert(
40 !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
41 "m doesn't appear as an own property on the C prototype"
42 );
43
44 verifyProperty(C, "m", {
45 enumerable: false,
46 configurable: true,
47 writable: true,
48 }, {restore: true});
49
50 C.m().next().then(function(v) {
51 assert.sameValue(v.value, 42);
52 assert.sameValue(v.done, true);
53
54 function assertions() {
55 // Cover $DONE handler for async cases.
56 function $DONE(error) {
57 if (error) {
58 throw new Test262Error('Test262:AsyncTestFailure')
59 }
60 }
61 assert(
62 !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
63 "a doesn't appear as an own property on C prototype"
64 );
65 assert(
66 !Object.prototype.hasOwnProperty.call(C, "a"),
67 "a doesn't appear as an own property on C constructor"
68 );
69
70 verifyProperty(c, "a", {
71 value: undefined,
72 enumerable: true,
73 writable: true,
74 configurable: true
75 });
76
77 assert(
78 !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
79 "b doesn't appear as an own property on C prototype"
80 );
81 assert(
82 !Object.prototype.hasOwnProperty.call(C, "b"),
83 "b doesn't appear as an own property on C constructor"
84 );
85
86 verifyProperty(c, "b", {
87 value: 42,
88 enumerable: true,
89 writable: true,
90 configurable: true
91 });
92
93 assert(
94 !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
95 "c doesn't appear as an own property on C prototype"
96 );
97 assert(
98 !Object.prototype.hasOwnProperty.call(C, "c"),
99 "c doesn't appear as an own property on C constructor"
100 );
101
102 verifyProperty(c, "c", {
103 value: fn,
104 enumerable: true,
105 writable: true,
106 configurable: true
107 });
108
109 }
110
111 return Promise.resolve(assertions());
112 }).then($DONE, $DONE);