only evaluate object destructuring pattern once
This commit is contained in:
parent
4ea0175ca7
commit
bcc9e016b1
@ -112,6 +112,12 @@ Destructuring.prototype.pushObjectPattern = function (pattern, parentId) {
|
||||
));
|
||||
}
|
||||
|
||||
if (pattern.properties.length > 1 && t.isMemberExpression(parentId)) {
|
||||
var temp = this.scope.generateUidBasedOnNode(parentId, this.file);
|
||||
this.nodes.push(this.buildVariableDeclaration(temp, parentId));
|
||||
parentId = temp;
|
||||
}
|
||||
|
||||
for (var i = 0; i < pattern.properties.length; i++) {
|
||||
var prop = pattern.properties[i];
|
||||
if (t.isSpreadProperty(prop)) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
var x1 = rect.topLeft.x;
|
||||
var y1 = rect.topLeft.y;
|
||||
var x2 = rect.bottomRight.x;
|
||||
var y2 = rect.bottomRight.y;
|
||||
var _rect$topLeft = rect.topLeft;
|
||||
var x1 = _rect$topLeft.x;
|
||||
var y1 = _rect$topLeft.y;
|
||||
var _rect$bottomRight = rect.bottomRight;
|
||||
var x2 = _rect$bottomRight.x;
|
||||
var y2 = _rect$bottomRight.y;
|
||||
@ -3,10 +3,12 @@
|
||||
var _slicedToArray = function (arr, i) { if (Array.isArray(arr)) { return arr; } else { var _arr = []; for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); if (i && _arr.length === i) break; } return _arr; } };
|
||||
|
||||
function somethingAdvanced(_ref) {
|
||||
var x1 = _ref.topLeft.x;
|
||||
var y1 = _ref.topLeft.y;
|
||||
var x2 = _ref.bottomRight.x;
|
||||
var y2 = _ref.bottomRight.y;
|
||||
var _ref$topLeft = _ref.topLeft;
|
||||
var x1 = _ref$topLeft.x;
|
||||
var y1 = _ref$topLeft.y;
|
||||
var _ref$bottomRight = _ref.bottomRight;
|
||||
var x2 = _ref$bottomRight.x;
|
||||
var y2 = _ref$bottomRight.y;
|
||||
}
|
||||
|
||||
function unpackObject(_ref) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user