break.js (587B)
1 // Copyright (C) 2013 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.6.4.13 S5.n 5 description: > 6 Control flow during body evaluation should honor `break` statements. 7 features: [generators] 8 ---*/ 9 10 function* values() { 11 yield 1; 12 throw new Test262Error('This code is unreachable (following `yield` statement).'); 13 } 14 var iterator = values(); 15 var i = 0; 16 17 for (var x of iterator) { 18 i++; 19 break; 20 21 throw new Test262Error('This code is unreachable.'); 22 } 23 24 assert.sameValue(i, 1); 25 26 reportCompare(0, 0);