parent
1b8d664bbe
commit
9308c870f5
@ -540,7 +540,12 @@ export default declare((api, options) => {
|
||||
destructuring.init(node.left, ref || node.right);
|
||||
|
||||
if (ref) {
|
||||
nodes.push(t.expressionStatement(t.cloneNode(ref)));
|
||||
if (path.parentPath.isArrowFunctionExpression()) {
|
||||
path.replaceWith(t.blockStatement([]));
|
||||
nodes.push(t.returnStatement(t.cloneNode(ref)));
|
||||
} else {
|
||||
nodes.push(t.expressionStatement(t.cloneNode(ref)));
|
||||
}
|
||||
}
|
||||
|
||||
path.replaceWithMultiple(nodes);
|
||||
|
||||
@ -0,0 +1 @@
|
||||
() => { [a, b] = [1, 2] }
|
||||
@ -0,0 +1,4 @@
|
||||
() => {
|
||||
a = 1;
|
||||
b = 2;
|
||||
};
|
||||
@ -0,0 +1 @@
|
||||
() => [a, b] = [1, 2]
|
||||
@ -0,0 +1,6 @@
|
||||
() => {
|
||||
var _ref = [1, 2];
|
||||
a = _ref[0];
|
||||
b = _ref[1];
|
||||
return _ref;
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user