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

master
Brian Ng 2017-04-13 09:10:08 -05:00 committed by Christopher Chedeau
parent 4dfe92a76b
commit 4d9edec4e1
2 changed files with 6 additions and 3 deletions

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" &&

View File

@ -1 +1 @@
run_spec(__dirname, { trailingComma: "all" });
run_spec(__dirname, { trailingComma: "all" }, ["babylon"]);