same-line-async-gen-string-literal-names.js (2982B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/class-elements/string-literal-names.case 4 // - src/class-elements/productions/cls-decl-after-same-line-async-gen.template 5 /*--- 6 description: String literal names (field definitions after an async generator in the same line) 7 esid: prod-FieldDefinition 8 features: [class-fields-public, class, async-iteration] 9 flags: [generated, async] 10 includes: [propertyHelper.js] 11 info: | 12 ClassElement: 13 ... 14 FieldDefinition ; 15 16 FieldDefinition: 17 ClassElementName Initializer_opt 18 19 ClassElementName: 20 PropertyName 21 22 ---*/ 23 24 25 class C { 26 async *m() { return 42; } 'a'; "b"; 'c' = 39; 27 "d" = 42; 28 29 } 30 31 var c = new C(); 32 33 assert( 34 !Object.prototype.hasOwnProperty.call(c, "m"), 35 "m doesn't appear as an own property on the C instance" 36 ); 37 assert.sameValue(c.m, C.prototype.m); 38 39 verifyProperty(C.prototype, "m", { 40 enumerable: false, 41 configurable: true, 42 writable: true, 43 }, {restore: true}); 44 45 c.m().next().then(function(v) { 46 assert.sameValue(v.value, 42); 47 assert.sameValue(v.done, true); 48 49 function assertions() { 50 // Cover $DONE handler for async cases. 51 function $DONE(error) { 52 if (error) { 53 throw new Test262Error('Test262:AsyncTestFailure') 54 } 55 } 56 assert( 57 !Object.prototype.hasOwnProperty.call(C.prototype, "a"), 58 "a does not appear as an own property on C prototype" 59 ); 60 assert( 61 !Object.prototype.hasOwnProperty.call(C, "a"), 62 "a does not appear as an own property on C constructor" 63 ); 64 65 verifyProperty(c, "a", { 66 value: undefined, 67 enumerable: true, 68 writable: true, 69 configurable: true 70 }); 71 72 assert( 73 !Object.prototype.hasOwnProperty.call(C.prototype, "b"), 74 "b does not appear as an own property on C prototype" 75 ); 76 assert( 77 !Object.prototype.hasOwnProperty.call(C, "b"), 78 "b does not appear as an own property on C constructor" 79 ); 80 81 verifyProperty(c, "b", { 82 value: undefined, 83 enumerable: true, 84 writable: true, 85 configurable: true 86 }); 87 88 assert( 89 !Object.prototype.hasOwnProperty.call(C.prototype, "c"), 90 "c does not appear as an own property on C prototype" 91 ); 92 assert( 93 !Object.prototype.hasOwnProperty.call(C, "c"), 94 "c does not appear as an own property on C constructor" 95 ); 96 97 verifyProperty(c, "c", { 98 value: 39, 99 enumerable: true, 100 writable: true, 101 configurable: true 102 }); 103 104 assert( 105 !Object.prototype.hasOwnProperty.call(C.prototype, "d"), 106 "d does not appear as an own property on C prototype" 107 ); 108 assert( 109 !Object.prototype.hasOwnProperty.call(C, "d"), 110 "d does not appear as an own property on C constructor" 111 ); 112 113 verifyProperty(c, "d", { 114 value: 42, 115 enumerable: true, 116 writable: true, 117 configurable: true 118 }); 119 } 120 121 return Promise.resolve(assertions()); 122 }).then($DONE, $DONE);