| 1 |
// |reftest| async |
| 2 |
// This file was procedurally generated from the following sources: |
| 3 |
// - src/class-elements/private-method-getter-usage.case |
| 4 |
// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template |
| 5 |
/*--- |
| 6 |
description: PrivateName CallExpression usage (Accesor get method) (field definitions after a static 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 |
static async m() { return 42; } get #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( |
| 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().then(function(v) { |
| 51 |
assert.sameValue(v, 42); |
| 52 |
|
| 53 |
function assertions() { |
| 54 |
// Cover $DONE handler for async cases. |
| 55 |
function $DONE(error) { |
| 56 |
if (error) { |
| 57 |
throw new Test262Error('Test262:AsyncTestFailure') |
| 58 |
} |
| 59 |
} |
| 60 |
assert.sameValue(c.method(), 'test262'); |
| 61 |
} |
| 62 |
|
| 63 |
return Promise.resolve(assertions()); |
| 64 |
}).then($DONE, $DONE); |