var-ary-ptrn-rest-id-direct.js (1698B)
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-var.template 4 /*--- 5 description: Lone rest element (direct binding) (for statement) 6 esid: sec-for-statement-runtime-semantics-labelledevaluation 7 features: [destructuring-binding] 8 flags: [generated] 9 includes: [compareArray.js] 10 info: | 11 IterationStatement : 12 for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement 13 14 1. Let varDcl be the result of evaluating VariableDeclarationList. 15 [...] 16 17 13.3.2.4 Runtime Semantics: Evaluation 18 19 VariableDeclarationList : VariableDeclarationList , VariableDeclaration 20 21 1. Let next be the result of evaluating VariableDeclarationList. 22 2. ReturnIfAbrupt(next). 23 3. Return the result of evaluating VariableDeclaration. 24 25 VariableDeclaration : BindingPattern Initializer 26 27 1. Let rhs be the result of evaluating Initializer. 28 2. Let rval be GetValue(rhs). 29 3. ReturnIfAbrupt(rval). 30 4. Return the result of performing BindingInitialization for BindingPattern 31 passing rval and undefined as arguments. 32 33 Runtime Semantics: IteratorBindingInitialization 34 35 BindingRestElement : ... BindingIdentifier 36 37 [...] 38 2. Let A be ! ArrayCreate(0). 39 3. Let n be 0. 40 4. Repeat, 41 [...] 42 f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). 43 g. Set n to n + 1. 44 45 ---*/ 46 47 var iterCount = 0; 48 49 for (var [...x] = [1]; iterCount < 1; ) { 50 assert(Array.isArray(x)); 51 assert.compareArray(x, [1]); 52 iterCount += 1; 53 } 54 55 assert.sameValue(iterCount, 1, 'Iteration occurred as expected'); 56 57 reportCompare(0, 0);