Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/async-generator/dstr-named-ary-ptrn-rest-id-elision.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-rest-id-elision.case
3 // - src/dstr-binding/default/async-gen-func-named-expr.template
4 /*---
5 description: Rest element following elision elements (async generator named function expression)
6 esid: sec-asyncgenerator-definitions-evaluation
7 features: [async-iteration]
8 flags: [generated, async]
9 info: |
10 AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
11 ( FormalParameters ) { AsyncGeneratorBody }
12
13 [...]
14 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
15 AsyncGeneratorBody, funcEnv, strict).
16 [...]
17
18
19 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
20 ArrayBindingPattern : [ Elisionopt BindingRestElement ]
21 1. If Elision is present, then
22 a. Let status be the result of performing
23 IteratorDestructuringAssignmentEvaluation of Elision with
24 iteratorRecord as the argument.
25 b. ReturnIfAbrupt(status).
26 2. Return the result of performing IteratorBindingInitialization for
27 BindingRestElement with iteratorRecord and environment as arguments.
28 ---*/
29 var values = [1, 2, 3, 4, 5];
30
31
32 var callCount = 0;
33 var f;
34 f = async function* h([ , , ...x]) {
35 assert(Array.isArray(x));
36 assert.sameValue(x.length, 3);
37 assert.sameValue(x[0], 3);
38 assert.sameValue(x[1], 4);
39 assert.sameValue(x[2], 5);
40 assert.notSameValue(x, values);
41 callCount = callCount + 1;
42 };
43
44 f(values).next().then(() => {
45 assert.sameValue(callCount, 1, 'invoked exactly once');
46 }).then($DONE, $DONE);