Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-elision.case
3 // - src/dstr-binding/default/async-gen-func-named-expr.template
4 /*---
5 description: Elision advances iterator (async generator named function expression)
6 esid: sec-asyncgenerator-definitions-evaluation
7 features: [generators, 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
21 ArrayBindingPattern : [ Elision ]
22
23 1. Return the result of performing
24 IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
25 as the argument.
26
27 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
28
29 Elision : ,
30
31 1. If iteratorRecord.[[done]] is false, then
32 a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
33 b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
34 c. ReturnIfAbrupt(next).
35 d. If next is false, set iteratorRecord.[[done]] to true.
36 2. Return NormalCompletion(empty).
37
38 ---*/
39 var first = 0;
40 var second = 0;
41 function* g() {
42 first += 1;
43 yield;
44 second += 1;
45 };
46
47
48 var callCount = 0;
49 var f;
50 f = async function* h([,]) {
51 assert.sameValue(first, 1);
52 assert.sameValue(second, 0);
53 callCount = callCount + 1;
54 };
55
56 f(g()).next().then(() => {
57 assert.sameValue(callCount, 1, 'invoked exactly once');
58 }).then($DONE, $DONE);