tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/dstr-meth-ary-ptrn-rest-not-final-id.js
raw symbols SCIP| 1 | // This file was procedurally generated from the following sources: |
| 2 | // - src/dstr-binding/ary-ptrn-rest-not-final-id.case |
| 3 | // - src/dstr-binding/default/cls-expr-meth.template |
| 4 | /*--- |
| 5 | description: Rest element (identifier) may not be followed by any element (class expression method) |
| 6 | esid: sec-class-definitions-runtime-semantics-evaluation |
| 7 | es6id: 14.5.16 |
| 8 | features: [destructuring-binding] |
| 9 | flags: [generated] |
| 10 | negative: |
| 11 | phase: parse |
| 12 | type: SyntaxError |
| 13 | info: | |
| 14 | ClassExpression : class BindingIdentifieropt ClassTail |
| 15 | |
| 16 | 1. If BindingIdentifieropt is not present, let className be undefined. |
| 17 | 2. Else, let className be StringValue of BindingIdentifier. |
| 18 | 3. Let value be the result of ClassDefinitionEvaluation of ClassTail |
| 19 | with argument className. |
| 20 | [...] |
| 21 | |
| 22 | 14.5.14 Runtime Semantics: ClassDefinitionEvaluation |
| 23 | |
| 24 | 21. For each ClassElement m in order from methods |
| 25 | a. If IsStatic of m is false, then |
| 26 | i. Let status be the result of performing |
| 27 | PropertyDefinitionEvaluation for m with arguments proto and |
| 28 | false. |
| 29 | [...] |
| 30 | |
| 31 | 14.3.8 Runtime Semantics: DefineMethod |
| 32 | |
| 33 | MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } |
| 34 | |
| 35 | [...] |
| 36 | 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, |
| 37 | scope, strict). If functionPrototype was passed as a parameter then pass its |
| 38 | value as the functionPrototype optional argument of FunctionCreate. |
| 39 | [...] |
| 40 | |
| 41 | 9.2.1 [[Call]] ( thisArgument, argumentsList) |
| 42 | |
| 43 | [...] |
| 44 | 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). |
| 45 | [...] |
| 46 | |
| 47 | 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) |
| 48 | |
| 49 | 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). |
| 50 | [...] |
| 51 | |
| 52 | 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) |
| 53 | |
| 54 | [...] |
| 55 | 23. Let iteratorRecord be Record {[[iterator]]: |
| 56 | CreateListIterator(argumentsList), [[done]]: false}. |
| 57 | 24. If hasDuplicates is true, then |
| 58 | [...] |
| 59 | 25. Else, |
| 60 | b. Let formalStatus be IteratorBindingInitialization for formals with |
| 61 | iteratorRecord and env as arguments. |
| 62 | [...] |
| 63 | |
| 64 | 13.3.3 Destructuring Binding Patterns |
| 65 | ArrayBindingPattern[Yield] : |
| 66 | [ Elisionopt BindingRestElement[?Yield]opt ] |
| 67 | [ BindingElementList[?Yield] ] |
| 68 | [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] |
| 69 | ---*/ |
| 70 | throw "Test262: This statement should not be evaluated."; |
| 71 | |
| 72 | var callCount = 0; |
| 73 | var C = class { |
| 74 | method([...x, y]) { |
| 75 | |
| 76 | callCount = callCount + 1; |
| 77 | } |
| 78 | }; |
| 79 | |
| 80 | new C().method([1, 2, 3]); |
| 81 | assert.sameValue(callCount, 1, 'method invoked exactly once'); |