tor-browser

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

private-field-rhs-await-present.js (1046B)


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