js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js
raw symbols SCIP| 1 | // This file was procedurally generated from the following sources: |
| 2 | // - src/dstr-binding/ary-ptrn-elem-id-iter-val.case |
| 3 | // - src/dstr-binding/default/cls-expr-private-meth-static.template |
| 4 | /*--- |
| 5 | description: SingleNameBinding when value iteration was completed previously (private static class expression method) |
| 6 | esid: sec-class-definitions-runtime-semantics-evaluation |
| 7 | features: [class, class-static-methods-private, 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 for |
| 24 | m with arguments F and false. |
| 25 | [...] |
| 26 | |
| 27 | 14.3.8 Runtime Semantics: DefineMethod |
| 28 | |
| 29 | MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } |
| 30 | |
| 31 | [...] |
| 32 | 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, |
| 33 | scope, strict). If functionPrototype was passed as a parameter then pass its |
| 34 | value as the functionPrototype optional argument of FunctionCreate. |
| 35 | [...] |
| 36 | |
| 37 | 9.2.1 [[Call]] ( thisArgument, argumentsList) |
| 38 | |
| 39 | [...] |
| 40 | 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). |
| 41 | [...] |
| 42 | |
| 43 | 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) |
| 44 | |
| 45 | 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). |
| 46 | [...] |
| 47 | |
| 48 | 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) |
| 49 | |
| 50 | [...] |
| 51 | 23. Let iteratorRecord be Record {[[iterator]]: |
| 52 | CreateListIterator(argumentsList), [[done]]: false}. |
| 53 | 24. If hasDuplicates is true, then |
| 54 | [...] |
| 55 | 25. Else, |
| 56 | b. Let formalStatus be IteratorBindingInitialization for formals with |
| 57 | iteratorRecord and env as arguments. |
| 58 | [...] |
| 59 | |
| 60 | 13.3.3.6 Runtime Semantics: IteratorBindingInitialization |
| 61 | |
| 62 | SingleNameBinding : BindingIdentifier Initializeropt |
| 63 | |
| 64 | [...] |
| 65 | 4. If iteratorRecord.[[done]] is false, then |
| 66 | a. Let next be IteratorStep(iteratorRecord.[[iterator]]). |
| 67 | b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. |
| 68 | c. ReturnIfAbrupt(next). |
| 69 | d. If next is false, set iteratorRecord.[[done]] to true. |
| 70 | e. Else, |
| 71 | [...] |
| 72 | i. Let v be IteratorValue(next). |
| 73 | ii. If v is an abrupt completion, set |
| 74 | iteratorRecord.[[done]] to true. |
| 75 | iii. ReturnIfAbrupt(v). |
| 76 | 5. If iteratorRecord.[[done]] is true, let v be undefined. |
| 77 | [...] |
| 78 | 8. Return InitializeReferencedBinding(lhs, v). |
| 79 | ---*/ |
| 80 | |
| 81 | var callCount = 0; |
| 82 | var C = class { |
| 83 | static #method([x, y, z]) { |
| 84 | assert.sameValue(x, 1); |
| 85 | assert.sameValue(y, 2); |
| 86 | assert.sameValue(z, 3); |
| 87 | callCount = callCount + 1; |
| 88 | } |
| 89 | |
| 90 | static get method() { |
| 91 | return this.#method; |
| 92 | } |
| 93 | }; |
| 94 | |
| 95 | C.method([1, 2, 3]); |
| 96 | assert.sameValue(callCount, 1, 'method invoked exactly once'); |
| 97 | |
| 98 | reportCompare(0, 0); |