new-sc-line-gen-private-method-usage.js (1438B)
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-new-sc-line-generator.template 4 /*--- 5 description: PrivateName CallExpression usage (private method) (field definitions followed by a method in a new line with a semicolon) 6 esid: prod-FieldDefinition 7 features: [class-methods-private, class, class-fields-public, generators] 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 *m() { return 42; } 28 method() { 29 return this.#m(); 30 } 31 } 32 33 var c = new C(); 34 35 assert.sameValue(c.m().next().value, 42); 36 assert.sameValue(c.m, C.prototype.m); 37 assert( 38 !Object.prototype.hasOwnProperty.call(c, "m"), 39 "m doesn't appear as an own property on the C instance" 40 ); 41 42 verifyProperty(C.prototype, "m", { 43 enumerable: false, 44 configurable: true, 45 writable: true, 46 }); 47 48 assert.sameValue(c.method(), 'test262'); 49 50 reportCompare(0, 0);