| 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 |
Attributes of the `arguments` object are valid yield expression operands. |
| 7 |
features: [generators] |
| 8 |
---*/ |
| 9 |
|
| 10 |
function* g() { |
| 11 |
yield arguments[0]; |
| 12 |
yield arguments[1]; |
| 13 |
yield arguments[2]; |
| 14 |
yield arguments[3]; |
| 15 |
} |
| 16 |
var iter = g(23, 45, 33); |
| 17 |
var result; |
| 18 |
|
| 19 |
result = iter.next(); |
| 20 |
assert.sameValue(result.value, 23, 'First result `value`'); |
| 21 |
assert.sameValue(result.done, false, 'First result `done` flag'); |
| 22 |
|
| 23 |
result = iter.next(); |
| 24 |
assert.sameValue(result.value, 45, 'Second result `value`'); |
| 25 |
assert.sameValue(result.done, false, 'Second result `done` flag'); |
| 26 |
|
| 27 |
result = iter.next(); |
| 28 |
assert.sameValue(result.value, 33, 'Third result `value`'); |
| 29 |
assert.sameValue(result.done, false, 'Third result `done` flag'); |
| 30 |
|
| 31 |
result = iter.next(); |
| 32 |
assert.sameValue( |
| 33 |
result.value, undefined, 'Fourth result `value` (unspecified parameter)' |
| 34 |
); |
| 35 |
assert.sameValue( |
| 36 |
result.done, false, 'Fourth result `done` flag (unspecified parameter)' |
| 37 |
); |
| 38 |
|
| 39 |
result = iter.next(); |
| 40 |
assert.sameValue(result.value, undefined, 'Final result `value`'); |
| 41 |
assert.sameValue(result.done, true, 'Final result `done` flag'); |