after-same-line-static-gen-private-method-usage.js (1519B)
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-after-same-line-static-gen.template 4 /*--- 5 description: PrivateName CallExpression usage (private method) (field definitions after a static generator in the same line) 6 esid: prod-FieldDefinition 7 features: [class-methods-private, generators, 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 static *m() { return 42; } #m() { return 'test262'; }; 27 method() { 28 return this.#m(); 29 } 30 } 31 32 var c = new C(); 33 34 assert.sameValue(C.m().next().value, 42); 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 }); 49 50 assert.sameValue(c.method(), 'test262'); 51 52 reportCompare(0, 0);