| 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-method.template |
| 5 |
/*--- |
| 6 |
description: String literal names (field definitions after an 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 |
|
| 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().then(function(v) { |
| 46 |
assert.sameValue(v, 42); |
| 47 |
|
| 48 |
function assertions() { |
| 49 |
// Cover $DONE handler for async cases. |
| 50 |
function $DONE(error) { |
| 51 |
if (error) { |
| 52 |
throw new Test262Error('Test262:AsyncTestFailure') |
| 53 |
} |
| 54 |
} |
| 55 |
assert( |
| 56 |
!Object.prototype.hasOwnProperty.call(C.prototype, "a"), |
| 57 |
"a does not appear as an own property on C prototype" |
| 58 |
); |
| 59 |
assert( |
| 60 |
!Object.prototype.hasOwnProperty.call(C, "a"), |
| 61 |
"a does not appear as an own property on C constructor" |
| 62 |
); |
| 63 |
|
| 64 |
verifyProperty(c, "a", { |
| 65 |
value: undefined, |
| 66 |
enumerable: true, |
| 67 |
writable: true, |
| 68 |
configurable: true |
| 69 |
}); |
| 70 |
|
| 71 |
assert( |
| 72 |
!Object.prototype.hasOwnProperty.call(C.prototype, "b"), |
| 73 |
"b does not appear as an own property on C prototype" |
| 74 |
); |
| 75 |
assert( |
| 76 |
!Object.prototype.hasOwnProperty.call(C, "b"), |
| 77 |
"b does not appear as an own property on C constructor" |
| 78 |
); |
| 79 |
|
| 80 |
verifyProperty(c, "b", { |
| 81 |
value: undefined, |
| 82 |
enumerable: true, |
| 83 |
writable: true, |
| 84 |
configurable: true |
| 85 |
}); |
| 86 |
|
| 87 |
assert( |
| 88 |
!Object.prototype.hasOwnProperty.call(C.prototype, "c"), |
| 89 |
"c does not appear as an own property on C prototype" |
| 90 |
); |
| 91 |
assert( |
| 92 |
!Object.prototype.hasOwnProperty.call(C, "c"), |
| 93 |
"c does not appear as an own property on C constructor" |
| 94 |
); |
| 95 |
|
| 96 |
verifyProperty(c, "c", { |
| 97 |
value: 39, |
| 98 |
enumerable: true, |
| 99 |
writable: true, |
| 100 |
configurable: true |
| 101 |
}); |
| 102 |
|
| 103 |
assert( |
| 104 |
!Object.prototype.hasOwnProperty.call(C.prototype, "d"), |
| 105 |
"d does not appear as an own property on C prototype" |
| 106 |
); |
| 107 |
assert( |
| 108 |
!Object.prototype.hasOwnProperty.call(C, "d"), |
| 109 |
"d does not appear as an own property on C constructor" |
| 110 |
); |
| 111 |
|
| 112 |
verifyProperty(c, "d", { |
| 113 |
value: 42, |
| 114 |
enumerable: true, |
| 115 |
writable: true, |
| 116 |
configurable: true |
| 117 |
}); |
| 118 |
} |
| 119 |
|
| 120 |
return Promise.resolve(assertions()); |
| 121 |
}).then($DONE, $DONE); |