tests/auto/qml/ecmascripttests/test262/test/language/statements/class/dstr-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-gen-meth-static.template |
| 4 | /*--- |
| 5 | description: Rest element containing an elision (static class expression generator method) |
| 6 | esid: sec-runtime-semantics-bindingclassdeclarationevaluation |
| 7 | es6id: 14.5.15 |
| 8 | features: [generators, destructuring-binding] |
| 9 | flags: [generated] |
| 10 | info: | |
| 11 | ClassDeclaration : class BindingIdentifier ClassTail |
| 12 | |
| 13 | 1. Let className be StringValue of BindingIdentifier. |
| 14 | 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with |
| 15 | argument className. |
| 16 | [...] |
| 17 | |
| 18 | 14.5.14 Runtime Semantics: ClassDefinitionEvaluation |
| 19 | |
| 20 | 21. For each ClassElement m in order from methods |
| 21 | a. If IsStatic of m is false, then |
| 22 | b. Else, |
| 23 | Let status be the result of performing PropertyDefinitionEvaluation for |
| 24 | m with arguments F and false. |
| 25 | [...] |
| 26 | |
| 27 | 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation |
| 28 | |
| 29 | GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody } |
| 30 | |
| 31 | 1. Let propKey be the result of evaluating PropertyName. |
| 32 | 2. ReturnIfAbrupt(propKey). |
| 33 | 3. If the function code for this GeneratorMethod is strict mode code, |
| 34 | let strict be true. Otherwise let strict be false. |
| 35 | 4. Let scope be the running execution context's LexicalEnvironment. |
| 36 | 5. Let closure be GeneratorFunctionCreate(Method, |
| 37 | StrictFormalParameters, GeneratorBody, scope, strict). |
| 38 | |
| 39 | 9.2.1 [[Call]] ( thisArgument, argumentsList) |
| 40 | |
| 41 | [...] |
| 42 | 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). |
| 43 | [...] |
| 44 | |
| 45 | 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) |
| 46 | |
| 47 | 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). |
| 48 | [...] |
| 49 | |
| 50 | 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) |
| 51 | |
| 52 | [...] |
| 53 | 23. Let iteratorRecord be Record {[[iterator]]: |
| 54 | CreateListIterator(argumentsList), [[done]]: false}. |
| 55 | 24. If hasDuplicates is true, then |
| 56 | [...] |
| 57 | 25. Else, |
| 58 | b. Let formalStatus be IteratorBindingInitialization for formals with |
| 59 | iteratorRecord and env as arguments. |
| 60 | [...] |
| 61 | |
| 62 | 13.3.3.6 Runtime Semantics: IteratorBindingInitialization |
| 63 | |
| 64 | BindingRestElement : ... BindingPattern |
| 65 | |
| 66 | 1. Let A be ArrayCreate(0). |
| 67 | [...] |
| 68 | 3. Repeat |
| 69 | [...] |
| 70 | b. If iteratorRecord.[[done]] is true, then |
| 71 | i. Return the result of performing BindingInitialization of |
| 72 | BindingPattern with A and environment as the arguments. |
| 73 | [...] |
| 74 | |
| 75 | 13.3.3.6 Runtime Semantics: IteratorBindingInitialization |
| 76 | |
| 77 | ArrayBindingPattern : [ Elision ] |
| 78 | |
| 79 | 1. Return the result of performing |
| 80 | IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord |
| 81 | as the argument. |
| 82 | |
| 83 | 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation |
| 84 | |
| 85 | Elision : , |
| 86 | |
| 87 | 1. If iteratorRecord.[[done]] is false, then |
| 88 | a. Let next be IteratorStep(iteratorRecord.[[iterator]]). |
| 89 | b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. |
| 90 | c. ReturnIfAbrupt(next). |
| 91 | d. If next is false, set iteratorRecord.[[done]] to true. |
| 92 | 2. Return NormalCompletion(empty). |
| 93 | |
| 94 | ---*/ |
| 95 | var first = 0; |
| 96 | var second = 0; |
| 97 | function* g() { |
| 98 | first += 1; |
| 99 | yield; |
| 100 | second += 1; |
| 101 | }; |
| 102 | |
| 103 | var callCount = 0; |
| 104 | class C { |
| 105 | static *method([...[,]]) { |
| 106 | assert.sameValue(first, 1); |
| 107 | assert.sameValue(second, 1); |
| 108 | callCount = callCount + 1; |
| 109 | } |
| 110 | }; |
| 111 | |
| 112 | C.method(g()).next(); |
| 113 | assert.sameValue(callCount, 1, 'method invoked exactly once'); |