summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/private-methods-eval-in-frame.js
blob: a8fd1d95832794b04db9529dfcf22578715a8e2b (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
// |jit-test| --enable-private-fields; --enable-private-methods;
load(libdir + 'asserts.js');
load(libdir + 'evalInFrame.js');

class B {
  #priv() {
    return 12;
  }

  #val = '';
  set #x(x) {
    this.#val = x + ' haha';
  }
  get #x() {
    return this.#val;
  }

  ef(str) {
    return evalInFrame(0, str);
  }
}

var b = new B();
assertEq(b.ef(`this.#priv();`), 12);
assertEq(b.ef(`this.#x = 'Hi'; this.#x`), 'Hi haha');