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