Debian Codegraph @

js/src/jit-test/tests/class/superPropProxy.js

raw
1 // Define constructor with a proxy as prototype
2 let hook = { get: function(target, name, receiver) { return receiver; } }
3 let Base = function() { }
4 Base.prototype = new Proxy(Base.prototype, hook);
5
6 class Derived extends Base {
7 test() {
8 // Check proxy receiver is |this|, rather than Base.[[Prototype]]
9 assertEq(super.x, this);
10 }
11
12 test_elem() {
13 // Check proxy receiver is |this|, rather than Base.[[Prototype]]
14 assertEq(super[0], this);
15 }
16 }
17
18 let d = new Derived();
19
20 for (let i = 0; i < 20; ++i) {
21 d.test();
22 d.test_elem();
23 }