multiple-definitions-string-literal-names.js (3507B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/string-literal-names.case 3 // - src/class-elements/productions/cls-decl-multiple-definitions.template 4 /*--- 5 description: String literal names (multiple fields definitions) 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 23 24 class C { 25 foo = "foobar"; 26 m() { return 42 } 27 'a'; "b"; 'c' = 39; 28 "d" = 42 29 m2() { return 39 } 30 bar = "barbaz"; 31 32 } 33 34 var c = new C(); 35 36 assert.sameValue(c.m(), 42); 37 assert( 38 !Object.prototype.hasOwnProperty.call(c, "m"), 39 "m doesn't appear as an own property on the C instance" 40 ); 41 assert.sameValue(c.m, C.prototype.m); 42 43 verifyProperty(C.prototype, "m", { 44 enumerable: false, 45 configurable: true, 46 writable: true, 47 }); 48 49 assert.sameValue(c.m2(), 39); 50 assert(! 51 Object.prototype.hasOwnProperty.call(c, "m2"), 52 "m2 doesn't appear as an own property on the C instance" 53 ); 54 assert.sameValue(c.m2, C.prototype.m2); 55 56 verifyProperty(C.prototype, "m2", { 57 enumerable: false, 58 configurable: true, 59 writable: true, 60 }); 61 62 assert.sameValue(c.foo, "foobar"); 63 assert( 64 !Object.prototype.hasOwnProperty.call(C, "foo"), 65 "foo doesn't appear as an own property on the C constructor" 66 ); 67 assert( 68 !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), 69 "foo doesn't appear as an own property on the C prototype" 70 ); 71 72 verifyProperty(c, "foo", { 73 value: "foobar", 74 enumerable: true, 75 configurable: true, 76 writable: true, 77 }); 78 79 assert.sameValue(c.bar, "barbaz"); 80 assert( 81 !Object.prototype.hasOwnProperty.call(C, "bar"), 82 "bar doesn't appear as an own property on the C constructor" 83 ); 84 assert( 85 !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), 86 "bar doesn't appear as an own property on the C prototype" 87 ); 88 89 verifyProperty(c, "bar", { 90 value: "barbaz", 91 enumerable: true, 92 configurable: true, 93 writable: true, 94 }); 95 96 assert( 97 !Object.prototype.hasOwnProperty.call(C.prototype, "a"), 98 "a does not appear as an own property on C prototype" 99 ); 100 assert( 101 !Object.prototype.hasOwnProperty.call(C, "a"), 102 "a does not appear as an own property on C constructor" 103 ); 104 105 verifyProperty(c, "a", { 106 value: undefined, 107 enumerable: true, 108 writable: true, 109 configurable: true 110 }); 111 112 assert( 113 !Object.prototype.hasOwnProperty.call(C.prototype, "b"), 114 "b does not appear as an own property on C prototype" 115 ); 116 assert( 117 !Object.prototype.hasOwnProperty.call(C, "b"), 118 "b does not appear as an own property on C constructor" 119 ); 120 121 verifyProperty(c, "b", { 122 value: undefined, 123 enumerable: true, 124 writable: true, 125 configurable: true 126 }); 127 128 assert( 129 !Object.prototype.hasOwnProperty.call(C.prototype, "c"), 130 "c does not appear as an own property on C prototype" 131 ); 132 assert( 133 !Object.prototype.hasOwnProperty.call(C, "c"), 134 "c does not appear as an own property on C constructor" 135 ); 136 137 verifyProperty(c, "c", { 138 value: 39, 139 enumerable: true, 140 writable: true, 141 configurable: true 142 }); 143 144 assert( 145 !Object.prototype.hasOwnProperty.call(C.prototype, "d"), 146 "d does not appear as an own property on C prototype" 147 ); 148 assert( 149 !Object.prototype.hasOwnProperty.call(C, "d"), 150 "d does not appear as an own property on C constructor" 151 ); 152 153 verifyProperty(c, "d", { 154 value: 42, 155 enumerable: true, 156 writable: true, 157 configurable: true 158 }); 159 160 reportCompare(0, 0);