| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case |
| 3 |
// - src/dstr-binding/error/async-gen-func-expr-dflt.template |
| 4 |
/*--- |
| 5 |
description: Error forwarding when IteratorValue returns an abrupt completion (async generator function expression (default parameter)) |
| 6 |
esid: sec-asyncgenerator-definitions-evaluation |
| 7 |
features: [Symbol.iterator, async-iteration] |
| 8 |
flags: [generated] |
| 9 |
info: | |
| 10 |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { |
| 11 |
AsyncGeneratorBody } |
| 12 |
|
| 13 |
[...] |
| 14 |
3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, |
| 15 |
AsyncGeneratorBody, scope, strict). |
| 16 |
[...] |
| 17 |
|
| 18 |
13.3.3.6 Runtime Semantics: IteratorBindingInitialization |
| 19 |
BindingRestElement : ... BindingIdentifier |
| 20 |
1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, |
| 21 |
environment). |
| 22 |
2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, |
| 23 |
[...] |
| 24 |
c. Let nextValue be IteratorValue(next). |
| 25 |
d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to |
| 26 |
true. |
| 27 |
e. ReturnIfAbrupt(nextValue). |
| 28 |
|
| 29 |
---*/ |
| 30 |
var poisonedValue = Object.defineProperty({}, 'value', { |
| 31 |
get: function() { |
| 32 |
throw new Test262Error(); |
| 33 |
} |
| 34 |
}); |
| 35 |
var iter = {}; |
| 36 |
iter[Symbol.iterator] = function() { |
| 37 |
return { |
| 38 |
next: function() { |
| 39 |
return poisonedValue; |
| 40 |
} |
| 41 |
}; |
| 42 |
}; |
| 43 |
|
| 44 |
|
| 45 |
var f = async function*([...x] = iter) { |
| 46 |
|
| 47 |
}; |
| 48 |
|
| 49 |
assert.throws(Test262Error, function() { |
| 50 |
f(); |
| 51 |
}); |