* destructuring private fields with array pattern / object pattern * wip: new test cases * destrucuring and rest for private properties * test case for loose private-loose * add transform-desturcturing for exec * update test case * remove getPrototypeOf imports from get and set * wip: destructure super assignment * throw "Destructuring to a super field is not supported yet." * fix tests and fix assignment pattern * remove CallExpression from AssignmentPattern
18 lines
326 B
JavaScript
18 lines
326 B
JavaScript
class Foo {
|
|
#client
|
|
|
|
constructor(props) {
|
|
this.#client = 1;
|
|
;([this.x = this.#client, this.#client, this.y = this.#client] = props);
|
|
}
|
|
|
|
getClient() {
|
|
return this.#client;
|
|
}
|
|
}
|
|
|
|
const foo = new Foo([undefined, 'bar']);
|
|
expect(foo.getClient()).toBe('bar');
|
|
expect(foo.x).toBe(1);
|
|
expect(foo.y).toBe('bar');
|