after-same-line-static-gen-computed-symbol-names.js (2588B)
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-after-same-line-static-gen.template 4 /*--- 5 description: Computed property symbol names (field definitions after a static generator in the same line) 6 esid: prod-FieldDefinition 7 features: [class-fields-public, Symbol, computed-property-names, 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 var x = Symbol(); 23 var y = Symbol(); 24 25 26 27 class C { 28 static *m() { return 42; } [x]; [y] = 42; 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, x), 52 "Symbol x doesn't appear as an own property on C prototype" 53 ); 54 assert( 55 !Object.prototype.hasOwnProperty.call(C, x), 56 "Symbol x doesn't appear as an own property on C constructor" 57 ); 58 59 verifyProperty(c, x, { 60 value: undefined, 61 enumerable: true, 62 writable: true, 63 configurable: true 64 }); 65 66 assert( 67 !Object.prototype.hasOwnProperty.call(C.prototype, y), 68 "Symbol y doesn't appear as an own property on C prototype" 69 ); 70 assert( 71 !Object.prototype.hasOwnProperty.call(C, y), 72 "Symbol y doesn't appear as an own property on C constructor" 73 ); 74 75 verifyProperty(c, y, { 76 value: 42, 77 enumerable: true, 78 writable: true, 79 configurable: true 80 }); 81 82 assert( 83 !Object.prototype.hasOwnProperty.call(C.prototype, "x"), 84 "x doesn't appear as an own property on C prototype" 85 ); 86 assert( 87 !Object.prototype.hasOwnProperty.call(C, "x"), 88 "x doesn't appear as an own property on C constructor" 89 ); 90 assert( 91 !Object.prototype.hasOwnProperty.call(c, "x"), 92 "x doesn't appear as an own property on C instance" 93 ); 94 95 assert( 96 !Object.prototype.hasOwnProperty.call(C.prototype, "y"), 97 "y doesn't appear as an own property on C prototype" 98 ); 99 assert( 100 !Object.prototype.hasOwnProperty.call(C, "y"), 101 "y doesn't appear as an own property on C constructor" 102 ); 103 assert( 104 !Object.prototype.hasOwnProperty.call(c, "y"), 105 "y doesn't appear as an own property on C instance" 106 ); 107 108 reportCompare(0, 0);