| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/class-elements/private-method-usage.case |
| 3 |
// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template |
| 4 |
/*--- |
| 5 |
description: PrivateName CallExpression usage (private method) (multiple stacked fields definitions through ASI) |
| 6 |
esid: prod-FieldDefinition |
| 7 |
features: [class-methods-private, class, class-fields-public] |
| 8 |
flags: [generated] |
| 9 |
includes: [propertyHelper.js] |
| 10 |
info: | |
| 11 |
Updated Productions |
| 12 |
|
| 13 |
CallExpression[Yield, Await]: |
| 14 |
CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] |
| 15 |
SuperCall[?Yield, ?Await] |
| 16 |
CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] |
| 17 |
CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] |
| 18 |
CallExpression[?Yield, ?Await].IdentifierName |
| 19 |
CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] |
| 20 |
CallExpression[?Yield, ?Await].PrivateName |
| 21 |
|
| 22 |
---*/ |
| 23 |
|
| 24 |
|
| 25 |
class C { |
| 26 |
#m() { return 'test262'; } |
| 27 |
foo = "foobar" |
| 28 |
bar = "barbaz"; |
| 29 |
method() { |
| 30 |
return this.#m(); |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
var c = new C(); |
| 35 |
|
| 36 |
assert.sameValue(c.foo, "foobar"); |
| 37 |
assert( |
| 38 |
!Object.prototype.hasOwnProperty.call(C, "foo"), |
| 39 |
"foo doesn't appear as an own property on the C constructor" |
| 40 |
); |
| 41 |
assert( |
| 42 |
!Object.prototype.hasOwnProperty.call(C.prototype, "foo"), |
| 43 |
"foo doesn't appear as an own property on the C prototype" |
| 44 |
); |
| 45 |
|
| 46 |
verifyProperty(c, "foo", { |
| 47 |
value: "foobar", |
| 48 |
enumerable: true, |
| 49 |
configurable: true, |
| 50 |
writable: true, |
| 51 |
}); |
| 52 |
|
| 53 |
assert.sameValue(c.bar, "barbaz"); |
| 54 |
assert( |
| 55 |
!Object.prototype.hasOwnProperty.call(C, "bar"), |
| 56 |
"bar doesn't appear as an own property on the C constructor" |
| 57 |
); |
| 58 |
assert( |
| 59 |
!Object.prototype.hasOwnProperty.call(C.prototype, "bar"), |
| 60 |
"bar doesn't appear as an own property on the C prototype" |
| 61 |
); |
| 62 |
|
| 63 |
verifyProperty(c, "bar", { |
| 64 |
value: "barbaz", |
| 65 |
enumerable: true, |
| 66 |
configurable: true, |
| 67 |
writable: true, |
| 68 |
}); |
| 69 |
|
| 70 |
assert.sameValue(c.method(), 'test262'); |
| 71 |
|
| 72 |
reportCompare(0, 0); |