Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/method-definition/yield-as-generator-method-binding-identifier.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` is a valid BindingIdentifier for GeneratorMethods outside of
7 strict mode.
8 features: [generators]
9 es6id: 12.1.1
10 flags: [noStrict]
11 ---*/
12
13 var iter, result;
14 var obj = {
15 *yield() { (yield 3) + (yield 4); }
16 }
17
18 iter = obj.yield();
19
20 result = iter.next();
21 assert.sameValue(result.value, 3, 'First result `value`');
22 assert.sameValue(result.done, false, 'First result `done` flag');
23
24 result = iter.next();
25 assert.sameValue(result.value, 4, 'Second result `value`');
26 assert.sameValue(result.done, false, 'Second result `done` flag');
27
28 result = iter.next();
29 assert.sameValue(result.value, undefined, 'Third result `value`');
30 assert.sameValue(result.done, true, 'Third result `done` flag');;