Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/generators/yield-as-yield-operand.js

raw
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 /*---
5 description: >
6 `yield` expressions may be used as the right-hand-side of other `yield`
7 expressions.
8 es6id: 14.4
9 features: [generators]
10 ---*/
11
12 var iter, result;
13 var g = function*() {
14 yield yield 1;
15 };
16
17 iter = g();
18
19 result = iter.next();
20 assert.sameValue(result.value, 1, 'First result `value`');
21 assert.sameValue(result.done, false, 'First result `done` flag');
22
23 result = iter.next();
24 assert.sameValue(result.value, undefined, 'Second result `value`');
25 assert.sameValue(result.done, false, 'Second result `done` flag');
26
27 result = iter.next();
28 assert.sameValue(result.value, undefined, 'Third result `value`');
29 assert.sameValue(result.done, true, 'Thid result `done` flag');