Fix trailing comma for rest element in Babylon (#1230)

This commit is contained in:
Brian Ng authored and Christopher Chedeau committed 2017-04-13 07:10:08 -07:00
1 parent 4dfe92a76b
commit 4d9edec4e1
2 files changed
+6 -3

No files matched your search

+5 -2
View File
@@ -706,8 +706,11 @@ function genericPrintNoParens(path, options, print, args) {
});
const lastElem = util.getLast(n[propertiesField]);
const canHaveTrailingComma = !(lastElem &&
lastElem.type === "RestProperty");
const canHaveTrailingComma = !(
lastElem &&
(lastElem.type === "RestProperty" || lastElem.type === "RestElement")
);
const shouldBreak =
n.type !== "ObjectPattern" &&
+1 -1
View File
@@ -1 +1 @@
run_spec(__dirname, { trailingComma: "all" });
run_spec(__dirname, { trailingComma: "all" }, ["babylon"]);