remove React.__spread and use extends helper instead - fixes #594

This commit is contained in:
Sebastian McKenzie
2015-01-27 06:43:57 +11:00
parent f256e18182
commit 6f2925ed83
5 changed files with 15 additions and 7 deletions

View File

@@ -65,7 +65,7 @@ exports.JSXOpeningElement = {
var attribs = node.attributes;
if (attribs.length) {
attribs = buildJSXOpeningElementAttributes(attribs);
attribs = buildJSXOpeningElementAttributes(attribs, file);
} else {
attribs = t.literal(null);
}
@@ -98,7 +98,7 @@ exports.JSXOpeningElement = {
* all prior attributes to an array for later processing.
*/
var buildJSXOpeningElementAttributes = function (attribs) {
var buildJSXOpeningElementAttributes = function (attribs, file) {
var _props = [];
var objs = [];
@@ -132,7 +132,7 @@ var buildJSXOpeningElementAttributes = function (attribs) {
// spread it
attribs = t.callExpression(
t.memberExpression(t.identifier("React"), t.identifier("__spread")),
file.addHelper("extends"),
objs
);
}

View File

@@ -1,2 +1,4 @@
React.createElement(Component, React.__spread({}, props, {
var _extends = function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { target[key] = source[key]; } } return target; };
React.createElement(Component, _extends({}, props, {
sound: "moo" }));

View File

@@ -1 +1,3 @@
React.createElement(Component, React.__spread({}, x, { y: 2, z: true }));
var _extends = function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { target[key] = source[key]; } } return target; };
React.createElement(Component, _extends({}, x, { y: 2, z: true }));

View File

@@ -1 +1,3 @@
React.createElement(Component, React.__spread({ y: 2, z: true }, x));
var _extends = function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { target[key] = source[key]; } } return target; };
React.createElement(Component, _extends({ y: 2, z: true }, x));

View File

@@ -1 +1,3 @@
React.createElement(Component, React.__spread({ y: 2 }, x, { z: true }));
var _extends = function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { target[key] = source[key]; } } return target; };
React.createElement(Component, _extends({ y: 2 }, x, { z: true }));