push to arguments instead of an array literal for jsx children

This commit is contained in:
Sebastian McKenzie 2014-10-22 21:44:08 +11:00
parent 035829e726
commit 1e6b8d80bb
3 changed files with 7 additions and 14 deletions

View File

@ -87,17 +87,10 @@ exports.XJSElement = {
var children = node.children;
var args = callExpr.arguments;
switch (children.length) {
case 0:
break;
case 1:
args.push(children[0]);
break;
default:
args.push(b.arrayExpression(children));
}
_.each(children, function (child) {
delete child.raw;
callExpr.arguments.push(child);
});
callExpr.loc = node.loc;
return callExpr;

View File

@ -1,8 +1,8 @@
"use strict";
X(null, a);
X(null, [a, " ", b]);
X(null, a, " ", b);
X({
prop: a,
yes: true
});
});

View File

@ -6,4 +6,4 @@ X({
X({
prop: "2"
}, [Y(null), Z(null)]);
}, Y(null), Z(null));