Recognize object rest properties as binding identifiers - fixes T7178

This commit is contained in:
Logan Smyth
2016-03-03 08:54:07 -08:00
parent 39a8f5b796
commit 305252d335
4 changed files with 34 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
import props from "props";
console.log(props);
(function(){
const { ...props } = this.props;
console.log(props);
})();

View File

@@ -0,0 +1,17 @@
"use strict";
var _props = require("props");
var _props2 = _interopRequireDefault(_props);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
console.log(_props2.default);
(function () {
const props = _objectWithoutProperties(this.props, []);
console.log(props);
})();

View File

@@ -0,0 +1,7 @@
{
"plugins": [
"transform-es2015-modules-commonjs",
"transform-es2015-destructuring",
"transform-object-rest-spread"
]
}

View File

@@ -91,7 +91,7 @@ getBindingIdentifiers.keys = {
RestElement: ["argument"],
UpdateExpression: ["argument"],
SpreadProperty: ["argument"],
RestProperty: ["argument"],
ObjectProperty: ["value"],
AssignmentPattern: ["left"],