var-ary-ptrn-rest-id-direct.js (1691B)
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/for-of-var.template 4 /*--- 5 description: Lone rest element (direct binding) (for-of statement) 6 esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation 7 features: [destructuring-binding] 8 flags: [generated] 9 includes: [compareArray.js] 10 info: | 11 IterationStatement : 12 for ( var ForBinding of AssignmentExpression ) Statement 13 14 [...] 15 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult, 16 varBinding, labelSet). 17 18 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation 19 20 [...] 21 3. Let destructuring be IsDestructuring of lhs. 22 [...] 23 5. Repeat 24 [...] 25 h. If destructuring is false, then 26 [...] 27 i. Else 28 i. If lhsKind is assignment, then 29 [...] 30 ii. Else if lhsKind is varBinding, then 31 1. Assert: lhs is a ForBinding. 32 2. Let status be the result of performing BindingInitialization 33 for lhs passing nextValue and undefined as the arguments. 34 [...] 35 36 Runtime Semantics: IteratorBindingInitialization 37 38 BindingRestElement : ... BindingIdentifier 39 40 [...] 41 2. Let A be ! ArrayCreate(0). 42 3. Let n be 0. 43 4. Repeat, 44 [...] 45 f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). 46 g. Set n to n + 1. 47 48 ---*/ 49 50 var iterCount = 0; 51 52 for (var [...x] of [[1]]) { 53 assert(Array.isArray(x)); 54 assert.compareArray(x, [1]); 55 56 iterCount += 1; 57 } 58 59 assert.sameValue(iterCount, 1, 'Iteration occurred as expected'); 60 61 reportCompare(0, 0);