tor-browser

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

private-field-rhs-yield-present.js (993B)


      1 // Copyright 2021 the V8 project authors.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: Parsing observes the `Yield` production parameter when present
      6 info: |
      7  Syntax
      8    RelationalExpression[In, Yield, Await]:
      9    [...]
     10    [+In]PrivateIdentifier in ShiftExpression[?Yield, ?Await]
     11 
     12  [...]
     13 
     14  1. Let privateIdentifier be the StringValue of PrivateIdentifier.
     15  2. Let rref be the result of evaluating ShiftExpression.
     16  3. Let rval be ? GetValue(rref).
     17  4. If Type(rval) is not Object, throw a TypeError exception.
     18 esid: sec-relational-operators-runtime-semantics-evaluation
     19 features: [class-fields-private, class-fields-private-in]
     20 ---*/
     21 
     22 class C {
     23  #field;
     24 
     25  static *isNameIn() {
     26    return #field in (yield);
     27  }
     28 }
     29 
     30 let iter1 = C.isNameIn();
     31 iter1.next();
     32 assert.sameValue(iter1.next(new C()).value, true);
     33 
     34 let iter2 = C.isNameIn();
     35 iter2.next();
     36 assert.sameValue(iter2.next({}).value, false);
     37 
     38 reportCompare(0, 0);