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