tor-browser

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

let-newline-yield-in-generator-function.js (789B)


      1 // |reftest| error:SyntaxError
      2 // Copyright (C) 2017 Mozilla Corporation. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 author: Jeff Walden <jwalden+code@mit.edu>
      7 esid: sec-let-and-const-declarations
      8 description: >
      9  `let yield` does not permit ASI in between, as `yield` is a BindingIdentifier
     10 info: |
     11  `yield` is a perfectly cromulent binding name in any context grammatically, just
     12  prohibited by static semantics in some contexts.  Therefore ASI can never apply
     13  between `let` (where a LexicalDeclaration is permitted) and `yield`,
     14  so a subsequent `0` where `=` was expected is a syntax error.
     15 negative:
     16  phase: parse
     17  type: SyntaxError
     18 features: [generators]
     19 ---*/
     20 
     21 $DONOTEVALUATE();
     22 
     23 function* f() {
     24    let
     25    yield 0;
     26 }