tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

yield-as-yield-operand.js (859B)


      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 features: [generators]
      9 es6id: 14.4
     10 ---*/
     11 
     12 var iter, result;
     13 var obj = {
     14  *g() {
     15    yield yield 1;
     16  }
     17 };
     18 
     19 iter = obj.g();
     20 
     21 result = iter.next();
     22 assert.sameValue(result.value, 1, 'First result `value`');
     23 assert.sameValue(result.done, false, 'First result `done` flag');
     24 
     25 result = iter.next();
     26 assert.sameValue(result.value, undefined, 'Second result `value`');
     27 assert.sameValue(result.done, false, 'Second result `done` flag');
     28 
     29 result = iter.next();
     30 assert.sameValue(result.value, undefined, 'Third result `value`');
     31 assert.sameValue(result.done, true, 'Thid result `done` flag');
     32 
     33 reportCompare(0, 0);