tor-browser

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

named-yield-identifier-spread-strict-strict.js (1047B)


      1 // |reftest| error:SyntaxError
      2 'use strict';
      3 // This file was procedurally generated from the following sources:
      4 // - src/generators/yield-identifier-spread-strict.case
      5 // - src/generators/default/expression-named.template
      6 /*---
      7 description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Named generator expression)
      8 esid: prod-GeneratorExpression
      9 features: [object-spread, generators]
     10 flags: [generated, onlyStrict]
     11 negative:
     12  phase: parse
     13  type: SyntaxError
     14 info: |
     15    14.4 Generator Function Definitions
     16 
     17    GeneratorExpression:
     18      function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
     19 
     20 
     21    Spread Properties
     22 
     23    PropertyDefinition[Yield]:
     24      (...)
     25      ...AssignmentExpression[In, ?Yield]
     26 
     27 ---*/
     28 $DONOTEVALUATE();
     29 
     30 var callCount = 0;
     31 
     32 var gen = function *g() {
     33  callCount += 1;
     34  return {
     35       ...(function() {
     36          var yield;
     37          throw new Test262Error();
     38       }()),
     39    }
     40 };
     41 
     42 var iter = gen();
     43 
     44 
     45 
     46 assert.sameValue(callCount, 1);