tor-browser

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

from-catch.js (767B)


      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    The behavior of `yield` expressions should not be affected when they appear
      7    within the `catch` block of `try` statements.
      8 features: [generators]
      9 ---*/
     10 
     11 function* g() {
     12  try {
     13    throw new Error();
     14  } catch (err) {
     15    yield 1;
     16  }
     17 }
     18 var iter = g();
     19 var result;
     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, 'Final result `value`');
     27 assert.sameValue(result.done, true, 'Final result `done`flag');
     28 
     29 reportCompare(0, 0);