tor-browser

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

private-field-presence-field.js (787B)


      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: Value when private name describes a field
      6 info: |
      7  7. Let privateName be ? GetValue(privateNameBinding).
      8  8. Assert: privateName is a Private Name.
      9  9. If privateName.[[Kind]] is "field",
     10     a. If ! PrivateFieldFind(privateName, rval) is not empty, then return true.
     11  [...]
     12  11. Return false.
     13 esid: sec-relational-operators-runtime-semantics-evaluation
     14 features: [class-fields-private, class-fields-private-in]
     15 ---*/
     16 
     17 class Class {
     18  #field;
     19 
     20  static isNameIn(value) {
     21    return #field in value;
     22  }
     23 }
     24 
     25 assert.sameValue(Class.isNameIn({}), false);
     26 assert.sameValue(Class.isNameIn(new Class()), true);
     27 
     28 reportCompare(0, 0);