async-gen-meth-dflt-ary-ptrn-rest-id-direct.js (1628B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/dstr-binding/ary-ptrn-rest-id-direct.case 4 // - src/dstr-binding/default/async-gen-method-dflt.template 5 /*--- 6 description: Lone rest element (direct binding) (async generator method (default parameter)) 7 esid: sec-asyncgenerator-definitions-propertydefinitionevaluation 8 features: [async-iteration] 9 flags: [generated, async] 10 includes: [compareArray.js] 11 info: | 12 AsyncGeneratorMethod : 13 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) 14 { AsyncGeneratorBody } 15 16 1. Let propKey be the result of evaluating PropertyName. 17 2. ReturnIfAbrupt(propKey). 18 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. 19 Otherwise let strict be false. 20 4. Let scope be the running execution context's LexicalEnvironment. 21 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, 22 AsyncGeneratorBody, scope, strict). 23 [...] 24 25 26 Runtime Semantics: IteratorBindingInitialization 27 28 BindingRestElement : ... BindingIdentifier 29 30 [...] 31 2. Let A be ! ArrayCreate(0). 32 3. Let n be 0. 33 4. Repeat, 34 [...] 35 f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). 36 g. Set n to n + 1. 37 38 ---*/ 39 40 41 var callCount = 0; 42 var obj = { 43 async *method([...x] = [1]) { 44 assert(Array.isArray(x)); 45 assert.compareArray(x, [1]); 46 callCount = callCount + 1; 47 } 48 }; 49 50 obj.method().next().then(() => { 51 assert.sameValue(callCount, 1, 'invoked exactly once'); 52 }).then($DONE, $DONE);