Lively 903b600522
fix: reference to class expression in private method (#13429)
Co-authored-by: Henry Zhu <hi@henryzoo.com>
Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-06-14 17:06:22 +02:00

32 lines
543 B
JavaScript

const f = class Foo {
static #bar() {
return Foo;
}
static #method() {
return function inner() {
return Foo;
};
}
static #method_shadowed() {
new Foo();
return function inner() {
let Foo = 3;
return Foo;
}
}
static extract() {
return {
bar: Foo.#bar,
method: Foo.#method,
method_shadowed: Foo.#method_shadowed
}
}
};
const { bar, method, method_shadowed } = f.extract();
expect(bar()).toBe(f)
expect(method()()).toBe(f)
expect(method_shadowed()()).toBe(3)