after-same-line-static-gen-literal-names.js (2150B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/literal-names.case 3 // - src/class-elements/productions/cls-decl-after-same-line-static-gen.template 4 /*--- 5 description: Literal property names (field definitions after a static generator in the same line) 6 esid: prod-FieldDefinition 7 features: [class-fields-public, generators, class] 8 flags: [generated] 9 includes: [propertyHelper.js] 10 info: | 11 ClassElement: 12 ... 13 FieldDefinition ; 14 15 FieldDefinition: 16 ClassElementName Initializer_opt 17 18 ClassElementName: 19 PropertyName 20 21 ---*/ 22 const fn = function() {} 23 24 25 26 class C { 27 static *m() { return 42; } a; b = 42; 28 c = fn; 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( 51 !Object.prototype.hasOwnProperty.call(C.prototype, "a"), 52 "a doesn't appear as an own property on C prototype" 53 ); 54 assert( 55 !Object.prototype.hasOwnProperty.call(C, "a"), 56 "a doesn't appear as an own property on C constructor" 57 ); 58 59 verifyProperty(c, "a", { 60 value: undefined, 61 enumerable: true, 62 writable: true, 63 configurable: true 64 }); 65 66 assert( 67 !Object.prototype.hasOwnProperty.call(C.prototype, "b"), 68 "b doesn't appear as an own property on C prototype" 69 ); 70 assert( 71 !Object.prototype.hasOwnProperty.call(C, "b"), 72 "b doesn't appear as an own property on C constructor" 73 ); 74 75 verifyProperty(c, "b", { 76 value: 42, 77 enumerable: true, 78 writable: true, 79 configurable: true 80 }); 81 82 assert( 83 !Object.prototype.hasOwnProperty.call(C.prototype, "c"), 84 "c doesn't appear as an own property on C prototype" 85 ); 86 assert( 87 !Object.prototype.hasOwnProperty.call(C, "c"), 88 "c doesn't appear as an own property on C constructor" 89 ); 90 91 verifyProperty(c, "c", { 92 value: fn, 93 enumerable: true, 94 writable: true, 95 configurable: true 96 }); 97 98 99 reportCompare(0, 0);