| 1 |
const f = class Foo { |
| 2 |
static #bar() { |
| 3 |
return Foo; |
| 4 |
} |
| 5 |
|
| 6 |
static #method() { |
| 7 |
return function inner() { |
| 8 |
return Foo; |
| 9 |
}; |
| 10 |
} |
| 11 |
static #method_shadowed() { |
| 12 |
new Foo(); |
| 13 |
return function inner() { |
| 14 |
let Foo = 3; |
| 15 |
return Foo; |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
static extract() { |
| 20 |
return { |
| 21 |
bar: Foo.#bar, |
| 22 |
method: Foo.#method, |
| 23 |
method_shadowed: Foo.#method_shadowed |
| 24 |
} |
| 25 |
} |
| 26 |
}; |
| 27 |
|
| 28 |
const { bar, method, method_shadowed } = f.extract(); |
| 29 |
expect(bar()).toBe(f) |
| 30 |
expect(method()()).toBe(f) |
| 31 |
expect(method_shadowed()()).toBe(3) |