head-expr-expr.js (738B)
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 var x; 20 21 for (x in null, { key: 0 }) { 22 assert.sameValue(x, 'key'); 23 iterCount += 1; 24 } 25 26 assert.sameValue(iterCount, 1); 27 28 reportCompare(0, 0);