break-label-from-catch.js (921B)
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 es6id: 13.6.4.13 S5.n 5 description: > 6 Control flow during body evaluation should honor `break` statements within 7 `try` blocks. 8 features: [generators] 9 ---*/ 10 11 function* values() { 12 yield 1; 13 throw new Test262Error('This code is unreachable (following `yield` statement).'); 14 } 15 var iterator = values(); 16 var i = 0; 17 18 outer: 19 while (true) { 20 for (var x of iterator) { 21 try { 22 throw new Error(); 23 } catch (err) { 24 i++; 25 break outer; 26 throw new Test262Error('This code is unreachable (following `break` statement).'); 27 } 28 29 throw new Test262Error('This code is unreachable (following `try` statement).'); 30 } 31 32 throw new Test262Error('This code is unreachable (following `for..of` statement).'); 33 } 34 35 assert.sameValue(i, 1); 36 37 reportCompare(0, 0);