Debian Codegraph @

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

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/class-elements/literal-names-asi.case
4 // - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
5 /*---
6 description: Literal property names with ASI (field definitions after a static async method in the same line)
7 esid: prod-FieldDefinition
8 features: [class-fields-public, class, async-functions]
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
24
25 class C {
26 static async m() { return 42; } a
27 b = 42;;
28
29 }
30
31 var c = new C();
32
33 assert(
34 !Object.prototype.hasOwnProperty.call(c, "m"),
35 "m doesn't appear as an own property on the C instance"
36 );
37 assert(
38 !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
39 "m doesn't appear as an own property on the C prototype"
40 );
41
42 verifyProperty(C, "m", {
43 enumerable: false,
44 configurable: true,
45 writable: true,
46 }, {restore: true});
47
48 C.m().then(function(v) {
49 assert.sameValue(v, 42);
50
51 function assertions() {
52 // Cover $DONE handler for async cases.
53 function $DONE(error) {
54 if (error) {
55 throw new Test262Error('Test262:AsyncTestFailure')
56 }
57 }
58 assert(
59 !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
60 "a doesn't appear as an own property on C prototype"
61 );
62 assert(
63 !Object.prototype.hasOwnProperty.call(C, "a"),
64 "a doesn't appear as an own property on C constructor"
65 );
66
67 verifyProperty(c, "a", {
68 value: undefined,
69 enumerable: true,
70 writable: true,
71 configurable: true
72 });
73
74 assert(
75 !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
76 "b doesn't appear as an own property on C prototype"
77 );
78 assert(
79 !Object.prototype.hasOwnProperty.call(C, "b"),
80 "b doesn't appear as an own property on C constructor"
81 );
82
83 verifyProperty(c, "b", {
84 value: 42,
85 enumerable: true,
86 writable: true,
87 configurable: true
88 });
89 }
90
91 return Promise.resolve(assertions());
92 }).then($DONE, $DONE);