destructuring private fields with array pattern / object patte… (#10017)
* 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
This commit is contained in:
committed by
Nicolò Ribaudo
parent
7f47cb65d0
commit
d3fe22f0e1
@@ -211,6 +211,19 @@ const privateNameHandlerSpec = {
|
||||
]);
|
||||
},
|
||||
|
||||
destructureSet(member) {
|
||||
const { privateNamesMap, file } = this;
|
||||
const { name } = member.node.property.id;
|
||||
const { id } = privateNamesMap.get(name);
|
||||
return t.memberExpression(
|
||||
t.callExpression(file.addHelper("classPrivateFieldDestructureSet"), [
|
||||
this.receiver(member),
|
||||
t.cloneNode(id),
|
||||
]),
|
||||
t.identifier("value"),
|
||||
);
|
||||
},
|
||||
|
||||
call(member, args) {
|
||||
// The first access (the get) should do the memo assignment.
|
||||
this.memoise(member, 1);
|
||||
|
||||
Reference in New Issue
Block a user