| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
let error = new Error(); |
| 24 |
|
| 25 |
|
| 26 |
var callCount = 0; |
| 27 |
|
| 28 |
var C = class { |
| 29 |
static async *#gen() { |
| 30 |
callCount += 1; |
| 31 |
yield Promise.reject(error); |
| 32 |
yield "unreachable"; |
| 33 |
} |
| 34 |
static get gen() { return this.#gen; } |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
assert( |
| 39 |
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), |
| 40 |
"#gen does not appear as an own property on C prototype" |
| 41 |
); |
| 42 |
assert( |
| 43 |
!Object.prototype.hasOwnProperty.call(C, "#gen"), |
| 44 |
"#gen does not appear as an own property on C constructor" |
| 45 |
); |
| 46 |
|
| 47 |
var iter = C.gen(); |
| 48 |
|
| 49 |
iter.next().then(() => { |
| 50 |
throw new Test262Error("Promise incorrectly resolved."); |
| 51 |
}).catch(rejectValue => { |
| 52 |
|
| 53 |
assert.sameValue(rejectValue, error); |
| 54 |
|
| 55 |
iter.next().then(({done, value}) => { |
| 56 |
|
| 57 |
assert.sameValue(done, true, "The value of IteratorResult.done is `true`"); |
| 58 |
assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`"); |
| 59 |
}).then($DONE, $DONE); |
| 60 |
}); |
| 61 |
|
| 62 |
assert.sameValue(callCount, 1); |
| 63 |
|
| 64 |
|
| 65 |
assert( |
| 66 |
!Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), |
| 67 |
"#gen does not appear as an own property on C prototype" |
| 68 |
); |
| 69 |
assert( |
| 70 |
!Object.prototype.hasOwnProperty.call(C, "#gen"), |
| 71 |
"#gen does not appear as an own property on C constructor" |
| 72 |
); |