| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-binding/obj-ptrn-rest-val-obj.case |
| 3 |
// - src/dstr-binding/default/async-gen-meth.template |
| 4 |
/*--- |
| 5 |
description: Rest object contains just unextracted data (async generator method) |
| 6 |
esid: sec-asyncgenerator-definitions-propertydefinitionevaluation |
| 7 |
features: [object-rest, async-iteration] |
| 8 |
flags: [generated, async] |
| 9 |
includes: [propertyHelper.js] |
| 10 |
info: | |
| 11 |
AsyncGeneratorMethod : |
| 12 |
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) |
| 13 |
{ AsyncGeneratorBody } |
| 14 |
|
| 15 |
1. Let propKey be the result of evaluating PropertyName. |
| 16 |
2. ReturnIfAbrupt(propKey). |
| 17 |
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. |
| 18 |
Otherwise let strict be false. |
| 19 |
4. Let scope be the running execution context's LexicalEnvironment. |
| 20 |
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, |
| 21 |
AsyncGeneratorBody, scope, strict). |
| 22 |
[...] |
| 23 |
|
| 24 |
---*/ |
| 25 |
|
| 26 |
|
| 27 |
var callCount = 0; |
| 28 |
var obj = { |
| 29 |
async *method({a, b, ...rest}) { |
| 30 |
assert.sameValue(rest.a, undefined); |
| 31 |
assert.sameValue(rest.b, undefined); |
| 32 |
|
| 33 |
verifyProperty(rest, "x", { |
| 34 |
enumerable: true, |
| 35 |
writable: true, |
| 36 |
configurable: true, |
| 37 |
value: 1 |
| 38 |
}); |
| 39 |
|
| 40 |
verifyProperty(rest, "y", { |
| 41 |
enumerable: true, |
| 42 |
writable: true, |
| 43 |
configurable: true, |
| 44 |
value: 2 |
| 45 |
}); |
| 46 |
callCount = callCount + 1; |
| 47 |
} |
| 48 |
}; |
| 49 |
|
| 50 |
obj.method({x: 1, y: 2, a: 5, b: 3}).next().then(() => { |
| 51 |
assert.sameValue(callCount, 1, 'invoked exactly once'); |
| 52 |
}).then($DONE, $DONE); |