| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 | |
| 6 var iter = {} | |
| 7 iter[Symbol.iterator] = () => ({ | |
| 8 next: () => ({}), | |
| 9 return: () => {throw 666} | |
| 10 }); | |
| 11 | |
| 12 | |
| 13 function* foo() { | |
| 14 for (let x of iter) {throw 42} | |
| 15 } | |
| 16 assertThrowsEquals(() => foo().next(), 42); | |
| 17 | |
| 18 | |
| 19 function* bar() { | |
| 20 let x; | |
| 21 { let gaga = () => {x}; | |
| 22 [[x]] = iter; | |
| 23 } | |
| 24 } | |
| 25 assertThrows(() => bar().next(), TypeError); | |
| 26 | |
| 27 | |
| 28 function baz() { | |
| 29 let x; | |
| 30 { let gaga = () => {x}; | |
| 31 let gugu = () => {gaga}; | |
| 32 [[x]] = iter; | |
| 33 } | |
| 34 } | |
| 35 assertThrows(baz, TypeError); | |
| OLD | NEW |