cptn-expr-skip-itr.js (1040B)
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 es6id: 13.7.5.11 5 description: > 6 Completion value when head has no declaration and iteration is skipped 7 info: | 8 IterationStatement : for ( LeftHandSideExpression in Expression ) Statement 9 10 1. Let keyResult be ForIn/OfHeadEvaluation( « », Expression, enumerate). 11 2. ReturnIfAbrupt(keyResult). 12 13 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation 14 15 [...] 16 7. If iterationKind is enumerate, then 17 a. If exprValue.[[value]] is null or undefined, then 18 i. Return Completion{[[type]]: break, [[value]]: empty, [[target]]: 19 empty}. 20 ---*/ 21 22 assert.sameValue(eval('var a; 1; for (a in undefined) { }'), undefined); 23 assert.sameValue(eval('var b; 2; for (b in undefined) { 3; }'), undefined); 24 assert.sameValue(eval('var c; 4; for (c in null) { }'), undefined); 25 assert.sameValue(eval('var d; 5; for (d in null) { 6; }'), undefined); 26 27 reportCompare(0, 0);