blob: ef53a1304bd1f2d2bcb494e3d7aaeb15803ec22d (
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
|
class Base {
m() { return "pass"; }
static m() { return "fail"; }
}
var key = {
toString() {
return "computed";
}
};
let obj1 = new class extends Base {
[key]() {}
// Private method with a directly preceding method using a computed key led
// to assigning the wrong home object.
#m() { return super.m(); }
m() { return this.#m(); }
};
assertEq(obj1.m(), "pass");
let obj2 = new class extends Base {
// Same test as above, but this time preceded by a static method.
static [key]() {}
#m() { return super.m(); }
m() { return this.#m(); }
};
assertEq(obj2.m(), "pass");
if (typeof reportCompare === "function")
reportCompare(0, 0);
|