wrapped-in-sc-literal-names.js (1729B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/literal-names.case 3 // - src/class-elements/productions/cls-expr-wrapped-in-sc.template 4 /*--- 5 description: Literal property names (fields definition wrapped in semicolons) 6 esid: prod-FieldDefinition 7 features: [class-fields-public, 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 var C = class { 27 ;;;; 28 ;;;;;;a; b = 42; 29 c = fn;;;;;;; 30 ;;;; 31 32 } 33 34 var c = new C(); 35 36 assert( 37 !Object.prototype.hasOwnProperty.call(C.prototype, "a"), 38 "a doesn't appear as an own property on C prototype" 39 ); 40 assert( 41 !Object.prototype.hasOwnProperty.call(C, "a"), 42 "a doesn't appear as an own property on C constructor" 43 ); 44 45 verifyProperty(c, "a", { 46 value: undefined, 47 enumerable: true, 48 writable: true, 49 configurable: true 50 }); 51 52 assert( 53 !Object.prototype.hasOwnProperty.call(C.prototype, "b"), 54 "b doesn't appear as an own property on C prototype" 55 ); 56 assert( 57 !Object.prototype.hasOwnProperty.call(C, "b"), 58 "b doesn't appear as an own property on C constructor" 59 ); 60 61 verifyProperty(c, "b", { 62 value: 42, 63 enumerable: true, 64 writable: true, 65 configurable: true 66 }); 67 68 assert( 69 !Object.prototype.hasOwnProperty.call(C.prototype, "c"), 70 "c doesn't appear as an own property on C prototype" 71 ); 72 assert( 73 !Object.prototype.hasOwnProperty.call(C, "c"), 74 "c doesn't appear as an own property on C constructor" 75 ); 76 77 verifyProperty(c, "c", { 78 value: fn, 79 enumerable: true, 80 writable: true, 81 configurable: true 82 }); 83 84 85 reportCompare(0, 0);