after-same-line-static-async-method-literal-names.js (2636B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/class-elements/literal-names.case 4 // - src/class-elements/productions/cls-expr-after-same-line-static-async-method.template 5 /*--- 6 description: Literal property names (field definitions after a static async method in the same line) 7 esid: prod-FieldDefinition 8 features: [class-fields-public, class, async-functions] 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 const fn = function() {} 24 25 26 27 var C = class { 28 static async m() { return 42; } a; b = 42; 29 c = fn; 30 31 } 32 33 var c = new C(); 34 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 }, {restore: true}); 49 50 C.m().then(function(v) { 51 assert.sameValue(v, 42); 52 53 function assertions() { 54 // Cover $DONE handler for async cases. 55 function $DONE(error) { 56 if (error) { 57 throw new Test262Error('Test262:AsyncTestFailure') 58 } 59 } 60 assert( 61 !Object.prototype.hasOwnProperty.call(C.prototype, "a"), 62 "a doesn't appear as an own property on C prototype" 63 ); 64 assert( 65 !Object.prototype.hasOwnProperty.call(C, "a"), 66 "a doesn't appear as an own property on C constructor" 67 ); 68 69 verifyProperty(c, "a", { 70 value: undefined, 71 enumerable: true, 72 writable: true, 73 configurable: true 74 }); 75 76 assert( 77 !Object.prototype.hasOwnProperty.call(C.prototype, "b"), 78 "b doesn't appear as an own property on C prototype" 79 ); 80 assert( 81 !Object.prototype.hasOwnProperty.call(C, "b"), 82 "b doesn't appear as an own property on C constructor" 83 ); 84 85 verifyProperty(c, "b", { 86 value: 42, 87 enumerable: true, 88 writable: true, 89 configurable: true 90 }); 91 92 assert( 93 !Object.prototype.hasOwnProperty.call(C.prototype, "c"), 94 "c doesn't appear as an own property on C prototype" 95 ); 96 assert( 97 !Object.prototype.hasOwnProperty.call(C, "c"), 98 "c doesn't appear as an own property on C constructor" 99 ); 100 101 verifyProperty(c, "c", { 102 value: fn, 103 enumerable: true, 104 writable: true, 105 configurable: true 106 }); 107 108 } 109 110 return Promise.resolve(assertions()); 111 }).then($DONE, $DONE);