gen-meth-ary-ptrn-rest-id-direct.js (2195B)
1 // This file was procedurally generated from the following sources: 2 // - src/dstr-binding/ary-ptrn-rest-id-direct.case 3 // - src/dstr-binding/default/gen-meth.template 4 /*--- 5 description: Lone rest element (direct binding) (generator method) 6 esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation 7 features: [generators, destructuring-binding] 8 flags: [generated] 9 includes: [compareArray.js] 10 info: | 11 GeneratorMethod : 12 * PropertyName ( StrictFormalParameters ) { GeneratorBody } 13 14 1. Let propKey be the result of evaluating PropertyName. 15 2. ReturnIfAbrupt(propKey). 16 3. If the function code for this GeneratorMethod is strict mode code, 17 let strict be true. Otherwise let strict be false. 18 4. Let scope be the running execution context's LexicalEnvironment. 19 5. Let closure be GeneratorFunctionCreate(Method, 20 StrictFormalParameters, GeneratorBody, scope, strict). 21 [...] 22 23 9.2.1 [[Call]] ( thisArgument, argumentsList) 24 25 [...] 26 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). 27 [...] 28 29 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) 30 31 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). 32 [...] 33 34 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) 35 36 [...] 37 23. Let iteratorRecord be Record {[[iterator]]: 38 CreateListIterator(argumentsList), [[done]]: false}. 39 24. If hasDuplicates is true, then 40 [...] 41 25. Else, 42 b. Let formalStatus be IteratorBindingInitialization for formals with 43 iteratorRecord and env as arguments. 44 [...] 45 46 Runtime Semantics: IteratorBindingInitialization 47 48 BindingRestElement : ... BindingIdentifier 49 50 [...] 51 2. Let A be ! ArrayCreate(0). 52 3. Let n be 0. 53 4. Repeat, 54 [...] 55 f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). 56 g. Set n to n + 1. 57 58 ---*/ 59 60 var callCount = 0; 61 var obj = { 62 *method([...x]) { 63 assert(Array.isArray(x)); 64 assert.compareArray(x, [1]); 65 callCount = callCount + 1; 66 } 67 }; 68 69 obj.method([1]).next(); 70 assert.sameValue(callCount, 1, 'generator method invoked exactly once'); 71 72 reportCompare(0, 0);