body-dstr-assign.js (731B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset 5 description: > 6 The left-hand side may take the form of a DestructuringAssignment. 7 info: | 8 ... 9 Else, 10 If lhsKind is assignment, then 11 Let status be the result of performing DestructuringAssignmentEvaluation of 12 assignmentPattern using nextValue as the argument. 13 14 features: [destructuring-assignment, for-of] 15 ---*/ 16 17 var iterationCount = 0; 18 var x; 19 20 for ([x] of [[0]]) { 21 assert.sameValue(x, 0); 22 iterationCount += 1; 23 } 24 25 assert.sameValue(iterationCount, 1); 26 27 reportCompare(0, 0);