Fix isPreviousLineEmpry on Windows (#1263)
parent
306870a2a0
commit
f3155c3fc1
|
@ -119,6 +119,9 @@ function skipNewline(text, index, opts) {
|
|||
|
||||
const atIndex = text.charAt(index);
|
||||
if (backwards) {
|
||||
if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
|
||||
return index - 2;
|
||||
}
|
||||
if (
|
||||
atIndex === "\n" ||
|
||||
atIndex === "\r" ||
|
||||
|
@ -127,9 +130,6 @@ function skipNewline(text, index, opts) {
|
|||
) {
|
||||
return index - 1;
|
||||
}
|
||||
if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
|
||||
return index - 2;
|
||||
}
|
||||
} else {
|
||||
if (atIndex === "\r" && text.charAt(index + 1) === "\n") {
|
||||
return index + 2;
|
||||
|
|
|
@ -54,6 +54,23 @@ switch (a) {
|
|||
if (1) {};
|
||||
c;
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case x:
|
||||
case y:
|
||||
call();
|
||||
|
||||
case z:
|
||||
call();
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case x: case y:
|
||||
call();
|
||||
|
||||
case z:
|
||||
call();
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
switch (foo) {
|
||||
case "bar":
|
||||
|
@ -106,6 +123,24 @@ switch (a) {
|
|||
c;
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case x:
|
||||
case y:
|
||||
call();
|
||||
|
||||
case z:
|
||||
call();
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case x:
|
||||
case y:
|
||||
call();
|
||||
|
||||
case z:
|
||||
call();
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`empty_switch.js 1`] = `
|
||||
|
|
|
@ -51,3 +51,20 @@ switch (a) {
|
|||
if (1) {};
|
||||
c;
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case x:
|
||||
case y:
|
||||
call();
|
||||
|
||||
case z:
|
||||
call();
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case x: case y:
|
||||
call();
|
||||
|
||||
case z:
|
||||
call();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue