Debian Codegraph @

js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-direct.js

raw
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-func-named-expr.template
5 /*---
6 description: Lone rest element (direct binding) (async generator named function expression)
7 esid: sec-asyncgenerator-definitions-evaluation
8 features: [async-iteration]
9 flags: [generated, async]
10 includes: [compareArray.js]
11 info: |
12 AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
13 ( FormalParameters ) { AsyncGeneratorBody }
14
15 [...]
16 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
17 AsyncGeneratorBody, funcEnv, strict).
18 [...]
19
20
21 Runtime Semantics: IteratorBindingInitialization
22
23 BindingRestElement : ... BindingIdentifier
24
25 [...]
26 2. Let A be ! ArrayCreate(0).
27 3. Let n be 0.
28 4. Repeat,
29 [...]
30 f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
31 g. Set n to n + 1.
32
33 ---*/
34
35
36 var callCount = 0;
37 var f;
38 f = async function* h([...x]) {
39 assert(Array.isArray(x));
40 assert.compareArray(x, [1]);
41 callCount = callCount + 1;
42 };
43
44 f([1]).next().then(() => {
45 assert.sameValue(callCount, 1, 'invoked exactly once');
46 }).then($DONE, $DONE);