js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-hole.js
raw symbols SCIP| 1 | // This file was procedurally generated from the following sources: |
| 2 | // - src/dstr-binding/ary-ptrn-elem-id-init-hole.case |
| 3 | // - src/dstr-binding/default/cls-expr-gen-meth-static.template |
| 4 | /*--- |
| 5 | description: Destructuring initializer with a "hole" (static class expression generator method) |
| 6 | esid: sec-class-definitions-runtime-semantics-evaluation |
| 7 | features: [generators, destructuring-binding] |
| 8 | flags: [generated] |
| 9 | info: | |
| 10 | ClassExpression : class BindingIdentifieropt ClassTail |
| 11 | |
| 12 | 1. If BindingIdentifieropt is not present, let className be undefined. |
| 13 | 2. Else, let className be StringValue of BindingIdentifier. |
| 14 | 3. Let value be the result of ClassDefinitionEvaluation of ClassTail |
| 15 | with 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 |
| 24 | for m with arguments F and false. |
| 25 | [...] |
| 26 | |
| 27 | 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation |
| 28 | |
| 29 | GeneratorMethod : |
| 30 | * PropertyName ( StrictFormalParameters ) { GeneratorBody } |
| 31 | |
| 32 | 1. Let propKey be the result of evaluating PropertyName. |
| 33 | 2. ReturnIfAbrupt(propKey). |
| 34 | 3. If the function code for this GeneratorMethod is strict mode code, |
| 35 | let strict be true. Otherwise let strict be false. |
| 36 | 4. Let scope be the running execution context's LexicalEnvironment. |
| 37 | 5. Let closure be GeneratorFunctionCreate(Method, |
| 38 | StrictFormalParameters, GeneratorBody, scope, strict). |
| 39 | |
| 40 | 9.2.1 [[Call]] ( thisArgument, argumentsList) |
| 41 | |
| 42 | [...] |
| 43 | 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). |
| 44 | [...] |
| 45 | |
| 46 | 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) |
| 47 | |
| 48 | 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). |
| 49 | [...] |
| 50 | |
| 51 | 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) |
| 52 | |
| 53 | [...] |
| 54 | 23. Let iteratorRecord be Record {[[iterator]]: |
| 55 | CreateListIterator(argumentsList), [[done]]: false}. |
| 56 | 24. If hasDuplicates is true, then |
| 57 | [...] |
| 58 | 25. Else, |
| 59 | b. Let formalStatus be IteratorBindingInitialization for formals with |
| 60 | iteratorRecord and env as arguments. |
| 61 | [...] |
| 62 | |
| 63 | 13.3.3.6 Runtime Semantics: IteratorBindingInitialization |
| 64 | SingleNameBinding : BindingIdentifier Initializeropt |
| 65 | [...] 6. If Initializer is present and v is undefined, then |
| 66 | a. Let defaultValue be the result of evaluating Initializer. |
| 67 | b. Let v be GetValue(defaultValue). |
| 68 | [...] |
| 69 | 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). |
| 70 | ---*/ |
| 71 | |
| 72 | var callCount = 0; |
| 73 | var C = class { |
| 74 | static *method([x = 23]) { |
| 75 | assert.sameValue(x, 23); |
| 76 | // another statement |
| 77 | callCount = callCount + 1; |
| 78 | } |
| 79 | }; |
| 80 | |
| 81 | C.method([,]).next(); |
| 82 | assert.sameValue(callCount, 1, 'method invoked exactly once'); |
| 83 | |
| 84 | reportCompare(0, 0); |