Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-method-usage.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/class-elements/private-method-usage.case
4 // - src/class-elements/productions/cls-decl-after-same-line-async-method.template
5 /*---
6 description: PrivateName CallExpression usage (private method) (field definitions after an async method in the same line)
7 esid: prod-FieldDefinition
8 features: [class-methods-private, class, class-fields-public, async-functions]
9 flags: [generated, async]
10 includes: [propertyHelper.js]
11 info: |
12 Updated Productions
13
14 CallExpression[Yield, Await]:
15 CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
16 SuperCall[?Yield, ?Await]
17 CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
18 CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
19 CallExpression[?Yield, ?Await].IdentifierName
20 CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
21 CallExpression[?Yield, ?Await].PrivateName
22
23 ---*/
24
25
26 class C {
27 async m() { return 42; } #m() { return 'test262'; };
28 method() {
29 return this.#m();
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.sameValue(c.m, C.prototype.m);
40
41 verifyProperty(C.prototype, "m", {
42 enumerable: false,
43 configurable: true,
44 writable: true,
45 }, {restore: true});
46
47 c.m().then(function(v) {
48 assert.sameValue(v, 42);
49
50 function assertions() {
51 // Cover $DONE handler for async cases.
52 function $DONE(error) {
53 if (error) {
54 throw new Test262Error('Test262:AsyncTestFailure')
55 }
56 }
57 assert.sameValue(c.method(), 'test262');
58 }
59
60 return Promise.resolve(assertions());
61 }).then($DONE, $DONE);