Debian Codegraph @

js/src/tests/test262/language/expressions/class/elements/same-line-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-expr-after-same-line-async-method.template
5 /*---
6 description: Literal property names with ASI (field definitions after an 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 var C = class {
26 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.sameValue(c.m, C.prototype.m);
38
39 verifyProperty(C.prototype, "m", {
40 enumerable: false,
41 configurable: true,
42 writable: true,
43 }, {restore: true});
44
45 c.m().then(function(v) {
46 assert.sameValue(v, 42);
47
48 function assertions() {
49 // Cover $DONE handler for async cases.
50 function $DONE(error) {
51 if (error) {
52 throw new Test262Error('Test262:AsyncTestFailure')
53 }
54 }
55 assert(
56 !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
57 "a doesn't appear as an own property on C prototype"
58 );
59 assert(
60 !Object.prototype.hasOwnProperty.call(C, "a"),
61 "a doesn't appear as an own property on C constructor"
62 );
63
64 verifyProperty(c, "a", {
65 value: undefined,
66 enumerable: true,
67 writable: true,
68 configurable: true
69 });
70
71 assert(
72 !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
73 "b doesn't appear as an own property on C prototype"
74 );
75 assert(
76 !Object.prototype.hasOwnProperty.call(C, "b"),
77 "b doesn't appear as an own property on C constructor"
78 );
79
80 verifyProperty(c, "b", {
81 value: 42,
82 enumerable: true,
83 writable: true,
84 configurable: true
85 });
86 }
87
88 return Promise.resolve(assertions());
89 }).then($DONE, $DONE);