tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/dstr-async-gen-meth-ary-ptrn-elem-ary-elision-iter.js
raw symbols SCIP| 1 | // This file was procedurally generated from the following sources: |
| 2 | // - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case |
| 3 | // - src/dstr-binding/default/async-gen-meth.template |
| 4 | /*--- |
| 5 | description: BindingElement with array binding pattern and initializer is not used (async generator method) |
| 6 | esid: sec-asyncgenerator-definitions-propertydefinitionevaluation |
| 7 | features: [generators, 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 | BindingElement : BindingPatternInitializer opt |
| 27 | |
| 28 | 1. If iteratorRecord.[[done]] is false, then |
| 29 | a. Let next be IteratorStep(iteratorRecord.[[iterator]]). |
| 30 | [...] |
| 31 | e. Else, |
| 32 | i. Let v be IteratorValue(next). |
| 33 | [...] |
| 34 | 4. Return the result of performing BindingInitialization of BindingPattern |
| 35 | with v and environment as the arguments. |
| 36 | |
| 37 | ---*/ |
| 38 | var callCount = 0; |
| 39 | function* g() { |
| 40 | callCount += 1; |
| 41 | }; |
| 42 | |
| 43 | |
| 44 | var callCount = 0; |
| 45 | var obj = { |
| 46 | async *method([[,] = g()]) { |
| 47 | assert.sameValue(callCount, 0); |
| 48 | callCount = callCount + 1; |
| 49 | } |
| 50 | }; |
| 51 | |
| 52 | obj.method([[]]).next().then(() => { |
| 53 | assert.sameValue(callCount, 1, 'invoked exactly once'); |
| 54 | }).then($DONE, $DONE); |