update params generator to work with new parameters

This commit is contained in:
Sebastian McKenzie 2015-01-24 16:32:37 +11:00
parent befa221bd9
commit 8eb3091a9d

View File

@ -8,25 +8,9 @@ exports._params = function (node, print) {
this.push("("); this.push("(");
print.join(node.params, { print.join(node.params, {
separator: ", ", separator: ", "
iterator: function (param, i) {
var def = node.defaults && node.defaults[i];
if (def) {
self.push(" = ");
print(def);
}
}
}); });
if (node.rest) {
if (node.params.length) {
this.push(", ");
}
this.push("...");
print(node.rest);
}
this.push(")"); this.push(")");
}; };
@ -73,7 +57,7 @@ exports.FunctionExpression = function (node, print) {
exports.ArrowFunctionExpression = function (node, print) { exports.ArrowFunctionExpression = function (node, print) {
if (node.async) this.push("async "); if (node.async) this.push("async ");
if (node.params.length === 1 && !node.defaults.length && !node.rest && t.isIdentifier(node.params[0])) { if (node.params.length === 1 && t.isIdentifier(node.params[0])) {
print(node.params[0]); print(node.params[0]);
} else { } else {
this._params(node, print); this._params(node, print);