new-sc-line-gen-computed-symbol-names.js (2507B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/computed-symbol-names.case 3 // - src/class-elements/productions/cls-decl-new-sc-line-generator.template 4 /*--- 5 description: Computed property symbol names (field definitions followed by a method in a new line with a semicolon) 6 esid: prod-FieldDefinition 7 features: [class-fields-public, Symbol, computed-property-names, class, generators] 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 var x = Symbol(); 23 var y = Symbol(); 24 25 26 27 class C { 28 [x]; [y] = 42; 29 *m() { return 42; } 30 31 } 32 33 var c = new C(); 34 35 assert.sameValue(c.m().next().value, 42); 36 assert.sameValue(c.m, C.prototype.m); 37 assert( 38 !Object.prototype.hasOwnProperty.call(c, "m"), 39 "m doesn't appear as an own property on the C instance" 40 ); 41 42 verifyProperty(C.prototype, "m", { 43 enumerable: false, 44 configurable: true, 45 writable: true, 46 }); 47 48 assert( 49 !Object.prototype.hasOwnProperty.call(C.prototype, x), 50 "Symbol x doesn't appear as an own property on C prototype" 51 ); 52 assert( 53 !Object.prototype.hasOwnProperty.call(C, x), 54 "Symbol x doesn't appear as an own property on C constructor" 55 ); 56 57 verifyProperty(c, x, { 58 value: undefined, 59 enumerable: true, 60 writable: true, 61 configurable: true 62 }); 63 64 assert( 65 !Object.prototype.hasOwnProperty.call(C.prototype, y), 66 "Symbol y doesn't appear as an own property on C prototype" 67 ); 68 assert( 69 !Object.prototype.hasOwnProperty.call(C, y), 70 "Symbol y doesn't appear as an own property on C constructor" 71 ); 72 73 verifyProperty(c, y, { 74 value: 42, 75 enumerable: true, 76 writable: true, 77 configurable: true 78 }); 79 80 assert( 81 !Object.prototype.hasOwnProperty.call(C.prototype, "x"), 82 "x doesn't appear as an own property on C prototype" 83 ); 84 assert( 85 !Object.prototype.hasOwnProperty.call(C, "x"), 86 "x doesn't appear as an own property on C constructor" 87 ); 88 assert( 89 !Object.prototype.hasOwnProperty.call(c, "x"), 90 "x doesn't appear as an own property on C instance" 91 ); 92 93 assert( 94 !Object.prototype.hasOwnProperty.call(C.prototype, "y"), 95 "y doesn't appear as an own property on C prototype" 96 ); 97 assert( 98 !Object.prototype.hasOwnProperty.call(C, "y"), 99 "y doesn't appear as an own property on C constructor" 100 ); 101 assert( 102 !Object.prototype.hasOwnProperty.call(c, "y"), 103 "y doesn't appear as an own property on C instance" 104 ); 105 106 reportCompare(0, 0);