| 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: 25.2 |
| 5 |
description: > |
| 6 |
When the `next` method of a generator-produced iterable is invoked without |
| 7 |
an argument, the corresponding `yield` expression should be evaluated as |
| 8 |
`undefined`. |
| 9 |
features: [generators] |
| 10 |
---*/ |
| 11 |
|
| 12 |
function* g() { actual = yield; } |
| 13 |
var expected = {}; |
| 14 |
var iter = g(); |
| 15 |
var actual, result; |
| 16 |
|
| 17 |
result = iter.next(); |
| 18 |
assert.sameValue(result.value, undefined, 'First result `value`'); |
| 19 |
assert.sameValue(result.done, false, 'First result `done` flag'); |
| 20 |
assert.sameValue( |
| 21 |
actual, undefined, 'Value of `yield` expression (prior to continuation)' |
| 22 |
); |
| 23 |
|
| 24 |
result = iter.next(expected); |
| 25 |
assert.sameValue(result.value, undefined, 'Second result `value`'); |
| 26 |
assert.sameValue(result.done, true, 'Second result `done` flag'); |
| 27 |
assert.sameValue( |
| 28 |
actual, expected, 'Value of `yield` expression (following continuation)' |
| 29 |
); |