Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/dstr-async-gen-meth-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-meth.template
4 /*---
5 description: Elision advances iterator (async generator method)
6 esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
7 features: [generators, async-iteration]
8 flags: [generated, async]
9 info: |
10 AsyncGeneratorMethod :
11 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
12 { AsyncGeneratorBody }
13
14 1. Let propKey be the result of evaluating PropertyName.
15 2. ReturnIfAbrupt(propKey).
16 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
17 Otherwise let strict be false.
18 4. Let scope be the running execution context's LexicalEnvironment.
19 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
20 AsyncGeneratorBody, scope, strict).
21 [...]
22
23
24 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
25
26 ArrayBindingPattern : [ Elision ]
27
28 1. Return the result of performing
29 IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
30 as the argument.
31
32 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
33
34 Elision : ,
35
36 1. If iteratorRecord.[[done]] is false, then
37 a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
38 b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
39 c. ReturnIfAbrupt(next).
40 d. If next is false, set iteratorRecord.[[done]] to true.
41 2. Return NormalCompletion(empty).
42
43 ---*/
44 var first = 0;
45 var second = 0;
46 function* g() {
47 first += 1;
48 yield;
49 second += 1;
50 };
51
52
53 var callCount = 0;
54 var obj = {
55 async *method([,]) {
56 assert.sameValue(first, 1);
57 assert.sameValue(second, 0);
58 callCount = callCount + 1;
59 }
60 };
61
62 obj.method(g()).next().then(() => {
63 assert.sameValue(callCount, 1, 'invoked exactly once');
64 }).then($DONE, $DONE);