summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/in/private-field-presence-accessor.js
blob: f684525631c1d6d74d7081b399d37ebd00e0a30a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2021 the V8 project authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: Value when private name describes an accessor method
info: |
  7. Let privateName be ? GetValue(privateNameBinding).
  8. Assert: privateName is a Private Name.
  [...]
  10. Else,
      a. Assert: privateName.[[Kind]] is "method" or "accessor".
      b. If PrivateBrandCheck(rval, privateName) is not an abrupt completion,
         then return true.
  11. Return false.
esid: sec-relational-operators-runtime-semantics-evaluation
features: [class-static-methods-private, class-fields-private-in]
---*/

let count = 0;

class Class {
  get #accessor() {
    count += 1;
  }

  static isNameIn(value) {
    return #accessor in value;
  }
}

assert.sameValue(Class.isNameIn({}), false);
assert.sameValue(Class.isNameIn(new Class()), true);
assert.sameValue(count, 0);

reportCompare(0, 0);