Debian Codegraph @

js/src/tests/test262/language/statements/async-generator/dstr/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-decl.template
5 /*---
6 description: Lone rest element (direct binding) (async generator function declaration)
7 esid: sec-asyncgenerator-definitions-instantiatefunctionobject
8 features: [async-iteration]
9 flags: [generated, async]
10 includes: [compareArray.js]
11 info: |
12 AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
13 ( FormalParameters ) { AsyncGeneratorBody }
14
15 [...]
16 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
17 scope, 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 async function* f([...x]) {
38 assert(Array.isArray(x));
39 assert.compareArray(x, [1]);
40 callCount = callCount + 1;
41 };
42 f([1]).next().then(() => {
43 assert.sameValue(callCount, 1, 'invoked exactly once');
44 }).then($DONE, $DONE);