src/nodes/massign.js in prettier-0.15.1 vs src/nodes/massign.js in prettier-0.16.0
- old
+ new
@@ -11,16 +11,17 @@
)
) {
right = group(join(concat([",", line]), right));
}
+ const parts = [join(concat([",", line]), path.call(print, "body", 0))];
+ if (path.getValue().body[0].comma) {
+ parts.push(",");
+ }
+
return group(
- concat([
- group(join(concat([",", line]), path.call(print, "body", 0))),
- " =",
- indent(concat([line, right]))
- ])
+ concat([group(concat(parts)), " =", indent(concat([line, right]))])
);
},
mlhs: makeList,
mlhs_add_post: (path, opts, print) =>
path.call(print, "body", 0).concat(path.call(print, "body", 1)),
@@ -38,21 +39,19 @@
// assignment, i.e., (a, b, c) = 1, 2, 3
// ignore the current node and just go straight to the content
return path.call(print, "body", 0);
}
- return group(
- concat([
- "(",
- indent(
- concat([
- softline,
- join(concat([",", line]), path.call(print, "body", 0))
- ])
- ),
- concat([softline, ")"])
- ])
- );
+ const parts = [
+ softline,
+ join(concat([",", line]), path.call(print, "body", 0))
+ ];
+
+ if (path.getValue().body[0].comma) {
+ parts.push(",");
+ }
+
+ return group(concat(["(", indent(concat(parts)), concat([softline, ")"])]));
},
mrhs: makeList,
mrhs_add_star: (path, opts, print) =>
path
.call(print, "body", 0)