| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-binding/obj-ptrn-id-trailing-comma.case |
| 3 |
// - src/dstr-binding/default/async-gen-method-dflt.template |
| 4 |
/*--- |
| 5 |
description: Trailing comma is allowed following BindingPropertyList (async generator method (default parameter)) |
| 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 Destructuring Binding Patterns |
| 25 |
|
| 26 |
ObjectBindingPattern[Yield] : |
| 27 |
{ } |
| 28 |
{ BindingPropertyList[?Yield] } |
| 29 |
{ BindingPropertyList[?Yield] , } |
| 30 |
---*/ |
| 31 |
|
| 32 |
|
| 33 |
var callCount = 0; |
| 34 |
var obj = { |
| 35 |
async *method({ x, } = { x: 23 }) { |
| 36 |
assert.sameValue(x, 23); |
| 37 |
callCount = callCount + 1; |
| 38 |
} |
| 39 |
}; |
| 40 |
|
| 41 |
obj.method().next().then(() => { |
| 42 |
assert.sameValue(callCount, 1, 'invoked exactly once'); |
| 43 |
}).then($DONE, $DONE); |