head-var-expr.js (735B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: Expression is allowed in head 6 info: | 7 IterationStatement : for ( ForDeclaration in Expression ) Statement 8 9 1. Let keyResult be the result of performing 10 ForIn/OfHeadEvaluation(BoundNames of ForDeclaration, Expression, 11 enumerate). 12 2. ReturnIfAbrupt(keyResult). 13 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult, 14 lexicalBinding, labelSet). 15 es6id: 13.7.5.11 16 ---*/ 17 18 var iterCount = 0; 19 20 for (var x in null, { key: 0 }) { 21 assert.sameValue(x, 'key'); 22 iterCount += 1; 23 } 24 25 assert.sameValue(iterCount, 1); 26 27 reportCompare(0, 0);