2015-03-30 18:48:02 +02:00
|
|
|
// Copyright (C) 2013 the V8 project authors. All rights reserved.
|
2015-02-18 23:56:07 +01:00
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
|
|
es6id: 13.6.4.13 S5.n
|
|
|
|
description: >
|
|
|
|
Control flow during body evaluation should honor `break` statements within
|
|
|
|
the `catch` block of `try` statements.
|
2015-04-07 20:50:43 +02:00
|
|
|
features: [generators]
|
2015-02-18 23:56:07 +01:00
|
|
|
---*/
|
|
|
|
|
|
|
|
function* values() {
|
|
|
|
yield 1;
|
2021-07-22 21:58:54 +02:00
|
|
|
throw new Test262Error('This code is unreachable (following `yield` statement).');
|
2015-02-18 23:56:07 +01:00
|
|
|
}
|
2015-04-07 20:50:43 +02:00
|
|
|
var iterator = values();
|
2015-02-18 23:56:07 +01:00
|
|
|
var i = 0;
|
|
|
|
|
2015-04-07 20:50:43 +02:00
|
|
|
for (var x of iterator) {
|
2015-02-18 23:56:07 +01:00
|
|
|
|
|
|
|
try {
|
|
|
|
throw new Error();
|
|
|
|
} catch (err) {
|
2015-04-07 20:50:43 +02:00
|
|
|
i++;
|
2015-02-18 23:56:07 +01:00
|
|
|
break;
|
2021-07-22 21:58:54 +02:00
|
|
|
throw new Test262Error('This code is unreachable (following `break` statement).');
|
2015-02-18 23:56:07 +01:00
|
|
|
}
|
|
|
|
|
2021-07-22 21:58:54 +02:00
|
|
|
throw new Test262Error('This code is unreachable (following `try` statement).');
|
2015-02-18 23:56:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
assert.sameValue(i, 1);
|