tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/dstr-async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js
raw symbols SCIP| 1 | // This file was procedurally generated from the following sources: |
| 2 | // - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case |
| 3 | // - src/dstr-binding/default/async-gen-method-dflt.template |
| 4 | /*--- |
| 5 | description: Rest element containing an object binding pattern (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.6 Runtime Semantics: IteratorBindingInitialization |
| 25 | |
| 26 | BindingRestElement : ... BindingPattern |
| 27 | |
| 28 | 1. Let A be ArrayCreate(0). |
| 29 | [...] |
| 30 | 3. Repeat |
| 31 | [...] |
| 32 | b. If iteratorRecord.[[done]] is true, then |
| 33 | i. Return the result of performing BindingInitialization of |
| 34 | BindingPattern with A and environment as the arguments. |
| 35 | [...] |
| 36 | ---*/ |
| 37 | let length = "outer"; |
| 38 | |
| 39 | |
| 40 | var callCount = 0; |
| 41 | var obj = { |
| 42 | async *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { |
| 43 | assert.sameValue(v, 7); |
| 44 | assert.sameValue(w, 8); |
| 45 | assert.sameValue(x, 9); |
| 46 | assert.sameValue(y, undefined); |
| 47 | assert.sameValue(z, 3); |
| 48 | |
| 49 | assert.sameValue(length, "outer", "the length prop is not set as a binding name"); |
| 50 | callCount = callCount + 1; |
| 51 | } |
| 52 | }; |
| 53 | |
| 54 | obj.method().next().then(() => { |
| 55 | assert.sameValue(callCount, 1, 'invoked exactly once'); |
| 56 | }).then($DONE, $DONE); |