parent
3a7559be58
commit
ee7cfa9501
|
@ -1189,12 +1189,17 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
const cons = path.call(consequentPath => {
|
||||
return join(
|
||||
hardline,
|
||||
consequentPath.map((p, i) => {
|
||||
const shouldAddLine =
|
||||
i !== n.consequent.length - 1 &&
|
||||
util.isNextLineEmpty(options.originalText, p.getValue());
|
||||
return concat([print(p), shouldAddLine ? hardline : ""]);
|
||||
})
|
||||
consequentPath
|
||||
.map((p, i) => {
|
||||
if (n.consequent[i].type === "EmptyStatement") {
|
||||
return null;
|
||||
}
|
||||
const shouldAddLine =
|
||||
i !== n.consequent.length - 1 &&
|
||||
util.isNextLineEmpty(options.originalText, p.getValue());
|
||||
return concat([print(p), shouldAddLine ? hardline : ""]);
|
||||
})
|
||||
.filter(e => e !== null)
|
||||
);
|
||||
}, "consequent");
|
||||
parts.push(
|
||||
|
|
|
@ -48,6 +48,12 @@ switch (x) {
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case b:
|
||||
if (1) {};
|
||||
c;
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
switch (foo) {
|
||||
case "bar":
|
||||
|
@ -93,6 +99,13 @@ switch (x) {
|
|||
break;
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case b:
|
||||
if (1) {
|
||||
}
|
||||
c;
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`empty_switch.js 1`] = `
|
||||
|
|
|
@ -45,3 +45,9 @@ switch (x) {
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case b:
|
||||
if (1) {};
|
||||
c;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue