Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/statements/class/dstr-async-gen-meth-static-ary-ptrn-rest-ary-elision.js

raw symbols SCIP
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-rest-ary-elision.case
3 // - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
4 /*---
5 description: Rest element containing an elision (static class expression async generator method)
6 esid: sec-runtime-semantics-bindingclassdeclarationevaluation
7 features: [generators, async-iteration]
8 flags: [generated, async]
9 info: |
10 ClassDeclaration : class BindingIdentifier ClassTail
11
12 1. Let className be StringValue of BindingIdentifier.
13 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
14 argument className.
15 [...]
16
17 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
18
19 21. For each ClassElement m in order from methods
20 a. If IsStatic of m is false, then
21 b. Else,
22 Let status be the result of performing PropertyDefinitionEvaluation for
23 m with arguments F and false.
24 [...]
25
26 Runtime Semantics: PropertyDefinitionEvaluation
27
28 AsyncGeneratorMethod :
29 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
30 { AsyncGeneratorBody }
31
32 1. Let propKey be the result of evaluating PropertyName.
33 2. ReturnIfAbrupt(propKey).
34 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
35 Otherwise let strict be false.
36 4. Let scope be the running execution context's LexicalEnvironment.
37 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
38 AsyncGeneratorBody, scope, strict).
39 [...]
40
41
42 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
43
44 BindingRestElement : ... BindingPattern
45
46 1. Let A be ArrayCreate(0).
47 [...]
48 3. Repeat
49 [...]
50 b. If iteratorRecord.[[done]] is true, then
51 i. Return the result of performing BindingInitialization of
52 BindingPattern with A and environment as the arguments.
53 [...]
54
55 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
56
57 ArrayBindingPattern : [ Elision ]
58
59 1. Return the result of performing
60 IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
61 as the argument.
62
63 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
64
65 Elision : ,
66
67 1. If iteratorRecord.[[done]] is false, then
68 a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
69 b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
70 c. ReturnIfAbrupt(next).
71 d. If next is false, set iteratorRecord.[[done]] to true.
72 2. Return NormalCompletion(empty).
73
74 ---*/
75 var first = 0;
76 var second = 0;
77 function* g() {
78 first += 1;
79 yield;
80 second += 1;
81 };
82
83
84 var callCount = 0;
85 class C {
86 static async *method([...[,]]) {
87 assert.sameValue(first, 1);
88 assert.sameValue(second, 1);
89 callCount = callCount + 1;
90 }
91 };
92
93 C.method(g()).next().then(() => {
94 assert.sameValue(callCount, 1, 'invoked exactly once');
95 }).then($DONE, $DONE);