update params generator to work with new parameters
This commit is contained in:
parent
befa221bd9
commit
8eb3091a9d
@ -8,25 +8,9 @@ exports._params = function (node, print) {
|
||||
this.push("(");
|
||||
|
||||
print.join(node.params, {
|
||||
separator: ", ",
|
||||
iterator: function (param, i) {
|
||||
var def = node.defaults && node.defaults[i];
|
||||
if (def) {
|
||||
self.push(" = ");
|
||||
print(def);
|
||||
}
|
||||
}
|
||||
separator: ", "
|
||||
});
|
||||
|
||||
if (node.rest) {
|
||||
if (node.params.length) {
|
||||
this.push(", ");
|
||||
}
|
||||
|
||||
this.push("...");
|
||||
print(node.rest);
|
||||
}
|
||||
|
||||
this.push(")");
|
||||
};
|
||||
|
||||
@ -73,7 +57,7 @@ exports.FunctionExpression = function (node, print) {
|
||||
exports.ArrowFunctionExpression = function (node, print) {
|
||||
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]);
|
||||
} else {
|
||||
this._params(node, print);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user