fix binding kind of destructured variables. (#4813)

Fixes #4516 and any other code that hoists into a scope
where function params are destructured.
This commit is contained in:
Samuel Reed
2016-11-08 12:51:54 -06:00
committed by Henry Zhu
parent 723ca0eef8
commit 5678e61c0f
13 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
function render({ text, className, id }) {
return () => (<Component text={text} className={className} id={id} />);
}

View File

@@ -0,0 +1,9 @@
function render(_ref) {
let text = _ref.text,
className = _ref.className,
id = _ref.id;
var _ref2 = <Component text={text} className={className} id={id} />;
return () => _ref2;
}

View File

@@ -0,0 +1,4 @@
{
"plugins": ["transform-es2015-destructuring", "transform-es2015-parameters", "transform-react-constant-elements", "syntax-jsx"]
}

View File

@@ -0,0 +1,4 @@
function render({ text, className, id, ...props }) {
// intentionally ignoring props
return () => (<Component text={text} className={className} id={id} />);
}

View File

@@ -0,0 +1,13 @@
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; }
function render(_ref) {
let text = _ref.text,
className = _ref.className,
id = _ref.id,
props = _objectWithoutProperties(_ref, ["text", "className", "id"]);
var _ref2 = <Component text={text} className={className} id={id} />;
// intentionally ignoring props
return () => _ref2;
}

View File

@@ -0,0 +1,6 @@
{
"plugins": ["transform-es2015-destructuring", "transform-es2015-parameters",
"transform-es2015-spread", "syntax-object-rest-spread",
"transform-react-constant-elements", "syntax-jsx"]
}

View File

@@ -0,0 +1,3 @@
function render({ text, className, id, ...props }) {
return () => (<Component text={text} className={className} id={id} {...props} />);
}

View File

@@ -0,0 +1,10 @@
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; }
function render(_ref) {
let text = _ref.text,
className = _ref.className,
id = _ref.id,
props = _objectWithoutProperties(_ref, ["text", "className", "id"]);
return () => <Component text={text} className={className} id={id} {...props} />;
}

View File

@@ -0,0 +1,6 @@
{
"plugins": ["transform-es2015-destructuring", "transform-es2015-parameters",
"transform-es2015-spread", "syntax-object-rest-spread",
"transform-react-constant-elements", "syntax-jsx"]
}

View File

@@ -0,0 +1,3 @@
function render({ text }) {
return () => (<Component text={text} />);
}

View File

@@ -0,0 +1,7 @@
function render(_ref) {
let text = _ref.text;
var _ref2 = <Component text={text} />;
return () => _ref2;
}

View File

@@ -0,0 +1,4 @@
{
"plugins": ["transform-es2015-destructuring", "transform-es2015-parameters", "transform-react-constant-elements", "syntax-jsx"]
}