tor-browser

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

param-dflt-yield-non-strict.js (656B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-function-definitions
      5 es6id: 14.1
      6 description: >
      7  The `yield` token is interpreted as an IdentifierReference within a generator
      8  and outside of strict mode
      9 info: |
     10  FunctionExpression :
     11    function BindingIdentifieropt ( FormalParameters ) { FunctionBody }
     12 features: [generators, default-parameters]
     13 flags: [noStrict]
     14 ---*/
     15 
     16 var yield = 23;
     17 var paramValue;
     18 
     19 function *g() {
     20  (function(x = yield) {
     21    paramValue = x;
     22  }());
     23 }
     24 
     25 g().next();
     26 
     27 assert.sameValue(paramValue, 23);
     28 
     29 reportCompare(0, 0);