| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-binding/obj-ptrn-prop-ary.case |
| 3 |
// - src/dstr-binding/default/async-gen-meth.template |
| 4 |
/*--- |
| 5 |
description: Object binding pattern with "nested" array binding pattern not using initializer (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.7 Runtime Semantics: KeyedBindingInitialization |
| 25 |
|
| 26 |
[...] |
| 27 |
3. If Initializer is present and v is undefined, then |
| 28 |
[...] |
| 29 |
4. Return the result of performing BindingInitialization for BindingPattern |
| 30 |
passing v and environment as arguments. |
| 31 |
---*/ |
| 32 |
|
| 33 |
|
| 34 |
var callCount = 0; |
| 35 |
var obj = { |
| 36 |
async *method({ w: [x, y, z] = [4, 5, 6] }) { |
| 37 |
assert.sameValue(x, 7); |
| 38 |
assert.sameValue(y, undefined); |
| 39 |
assert.sameValue(z, undefined); |
| 40 |
|
| 41 |
assert.throws(ReferenceError, function() { |
| 42 |
w; |
| 43 |
}); |
| 44 |
callCount = callCount + 1; |
| 45 |
} |
| 46 |
}; |
| 47 |
|
| 48 |
obj.method({ w: [7, undefined, ] }).next().then(() => { |
| 49 |
assert.sameValue(callCount, 1, 'invoked exactly once'); |
| 50 |
}).then($DONE, $DONE); |