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 function iterable(done) { |
| 6 return { |
| 7 [Symbol.iterator]: function() { |
| 8 return { |
| 9 next: function() { |
| 10 if (done) return { done: true }; |
| 11 done = true; |
| 12 return { value: 42, done: false }; |
| 13 } |
| 14 } |
| 15 } |
| 16 } |
| 17 } |
| 18 |
| 19 var [...result] = iterable(true); |
| 20 assertEquals([], result); |
| 21 |
| 22 var [...result] = iterable(false); |
| 23 assertEquals([42], result); |
OLD | NEW |