tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/dstr-gen-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/gen-meth.template |
| 4 | /*--- |
| 5 | description: Rest element (identifier) may not be followed by any element (generator method) |
| 6 | esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation |
| 7 | es6id: 14.4.13 |
| 8 | features: [generators, destructuring-binding] |
| 9 | flags: [generated] |
| 10 | negative: |
| 11 | phase: parse |
| 12 | type: SyntaxError |
| 13 | info: | |
| 14 | GeneratorMethod : |
| 15 | * PropertyName ( StrictFormalParameters ) { GeneratorBody } |
| 16 | |
| 17 | 1. Let propKey be the result of evaluating PropertyName. |
| 18 | 2. ReturnIfAbrupt(propKey). |
| 19 | 3. If the function code for this GeneratorMethod is strict mode code, |
| 20 | let strict be true. Otherwise let strict be false. |
| 21 | 4. Let scope be the running execution context's LexicalEnvironment. |
| 22 | 5. Let closure be GeneratorFunctionCreate(Method, |
| 23 | StrictFormalParameters, GeneratorBody, scope, strict). |
| 24 | [...] |
| 25 | |
| 26 | 9.2.1 [[Call]] ( thisArgument, argumentsList) |
| 27 | |
| 28 | [...] |
| 29 | 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). |
| 30 | [...] |
| 31 | |
| 32 | 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) |
| 33 | |
| 34 | 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). |
| 35 | [...] |
| 36 | |
| 37 | 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) |
| 38 | |
| 39 | [...] |
| 40 | 23. Let iteratorRecord be Record {[[iterator]]: |
| 41 | CreateListIterator(argumentsList), [[done]]: false}. |
| 42 | 24. If hasDuplicates is true, then |
| 43 | [...] |
| 44 | 25. Else, |
| 45 | b. Let formalStatus be IteratorBindingInitialization for formals with |
| 46 | iteratorRecord and env as arguments. |
| 47 | [...] |
| 48 | |
| 49 | 13.3.3 Destructuring Binding Patterns |
| 50 | ArrayBindingPattern[Yield] : |
| 51 | [ Elisionopt BindingRestElement[?Yield]opt ] |
| 52 | [ BindingElementList[?Yield] ] |
| 53 | [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] |
| 54 | ---*/ |
| 55 | throw "Test262: This statement should not be evaluated."; |
| 56 | |
| 57 | var callCount = 0; |
| 58 | var obj = { |
| 59 | *method([...x, y]) { |
| 60 | |
| 61 | callCount = callCount + 1; |
| 62 | } |
| 63 | }; |
| 64 | |
| 65 | obj.method([1, 2, 3]).next(); |
| 66 | assert.sameValue(callCount, 1, 'generator method invoked exactly once'); |