| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-binding/ary-name-iter-val.case |
| 3 |
// - src/dstr-binding/default/async-gen-meth.template |
| 4 |
/*--- |
| 5 |
description: SingleNameBinding with normal value iteration (async generator method) |
| 6 |
esid: sec-asyncgenerator-definitions-propertydefinitionevaluation |
| 7 |
features: [async-iteration] |
| 8 |
flags: [generated, async] |
| 9 |
info: | |
| 10 |
AsyncGeneratorMethod : |
| 11 |
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) |
| 12 |
{ AsyncGeneratorBody } |
| 13 |
|
| 14 |
1. Let propKey be the result of evaluating PropertyName. |
| 15 |
2. ReturnIfAbrupt(propKey). |
| 16 |
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. |
| 17 |
Otherwise let strict be false. |
| 18 |
4. Let scope be the running execution context's LexicalEnvironment. |
| 19 |
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, |
| 20 |
AsyncGeneratorBody, scope, strict). |
| 21 |
[...] |
| 22 |
|
| 23 |
|
| 24 |
13.3.3.6 Runtime Semantics: IteratorBindingInitialization |
| 25 |
|
| 26 |
SingleNameBinding : BindingIdentifier Initializeropt |
| 27 |
|
| 28 |
[...] |
| 29 |
4. If iteratorRecord.[[done]] is false, then |
| 30 |
a. Let next be IteratorStep(iteratorRecord.[[iterator]]). |
| 31 |
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. |
| 32 |
c. ReturnIfAbrupt(next). |
| 33 |
d. If next is false, set iteratorRecord.[[done]] to true. |
| 34 |
e. Else, |
| 35 |
[...] |
| 36 |
i. Let v be IteratorValue(next). |
| 37 |
ii. If v is an abrupt completion, set |
| 38 |
iteratorRecord.[[done]] to true. |
| 39 |
iii. ReturnIfAbrupt(v). |
| 40 |
5. If iteratorRecord.[[done]] is true, let v be undefined. |
| 41 |
[...] |
| 42 |
8. Return InitializeReferencedBinding(lhs, v). |
| 43 |
---*/ |
| 44 |
|
| 45 |
|
| 46 |
var callCount = 0; |
| 47 |
var obj = { |
| 48 |
async *method([x, y, z]) { |
| 49 |
assert.sameValue(x, 1); |
| 50 |
assert.sameValue(y, 2); |
| 51 |
assert.sameValue(z, 3); |
| 52 |
callCount = callCount + 1; |
| 53 |
} |
| 54 |
}; |
| 55 |
|
| 56 |
obj.method([1, 2, 3]).next().then(() => { |
| 57 |
assert.sameValue(callCount, 1, 'invoked exactly once'); |
| 58 |
}).then($DONE, $DONE); |