multiple-stacked-definitions-literal-names-asi.js (2203B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/literal-names-asi.case 3 // - src/class-elements/productions/cls-expr-multiple-stacked-definitions.template 4 /*--- 5 description: Literal property names with ASI (multiple stacked fields definitions through ASI) 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 var C = class { 25 a 26 b = 42; 27 foo = "foobar" 28 bar = "barbaz"; 29 30 } 31 32 var c = new C(); 33 34 assert.sameValue(c.foo, "foobar"); 35 assert( 36 !Object.prototype.hasOwnProperty.call(C, "foo"), 37 "foo doesn't appear as an own property on the C constructor" 38 ); 39 assert( 40 !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), 41 "foo doesn't appear as an own property on the C prototype" 42 ); 43 44 verifyProperty(c, "foo", { 45 value: "foobar", 46 enumerable: true, 47 configurable: true, 48 writable: true, 49 }); 50 51 assert.sameValue(c.bar, "barbaz"); 52 assert( 53 !Object.prototype.hasOwnProperty.call(C, "bar"), 54 "bar doesn't appear as an own property on the C constructor" 55 ); 56 assert( 57 !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), 58 "bar doesn't appear as an own property on the C prototype" 59 ); 60 61 verifyProperty(c, "bar", { 62 value: "barbaz", 63 enumerable: true, 64 configurable: true, 65 writable: true, 66 }); 67 68 assert( 69 !Object.prototype.hasOwnProperty.call(C.prototype, "a"), 70 "a doesn't appear as an own property on C prototype" 71 ); 72 assert( 73 !Object.prototype.hasOwnProperty.call(C, "a"), 74 "a doesn't appear as an own property on C constructor" 75 ); 76 77 verifyProperty(c, "a", { 78 value: undefined, 79 enumerable: true, 80 writable: true, 81 configurable: true 82 }); 83 84 assert( 85 !Object.prototype.hasOwnProperty.call(C.prototype, "b"), 86 "b doesn't appear as an own property on C prototype" 87 ); 88 assert( 89 !Object.prototype.hasOwnProperty.call(C, "b"), 90 "b doesn't appear as an own property on C constructor" 91 ); 92 93 verifyProperty(c, "b", { 94 value: 42, 95 enumerable: true, 96 writable: true, 97 configurable: true 98 }); 99 100 reportCompare(0, 0);