tor-browser

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

yield-identifier-strict-strict.js (1005B)


      1 // |reftest| error:SyntaxError
      2 'use strict';
      3 // This file was procedurally generated from the following sources:
      4 // - src/generators/yield-identifier-strict.case
      5 // - src/generators/default/class-expr-method.template
      6 /*---
      7 description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator method as a ClassExpression element)
      8 esid: prod-GeneratorMethod
      9 features: [generators]
     10 flags: [generated, onlyStrict]
     11 negative:
     12  phase: parse
     13  type: SyntaxError
     14 info: |
     15    ClassElement :
     16      MethodDefinition
     17 
     18    MethodDefinition :
     19      GeneratorMethod
     20 
     21    14.4 Generator Function Definitions
     22 
     23    GeneratorMethod :
     24      * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
     25 
     26 ---*/
     27 $DONOTEVALUATE();
     28 
     29 var callCount = 0;
     30 
     31 var C = class {*gen() {
     32    callCount += 1;
     33    (function() {
     34        var yield;
     35        throw new Test262Error();
     36      }())
     37 }}
     38 
     39 var gen = C.prototype.gen;
     40 
     41 var iter = gen();
     42 
     43 
     44 
     45 assert.sameValue(callCount, 1);