Fix isPreviousLineEmpry on Windows (#1263)

master
Janic Duplessis 2017-04-14 19:02:19 -04:00 committed by Christopher Chedeau
parent 306870a2a0
commit f3155c3fc1
3 changed files with 55 additions and 3 deletions

View File

@ -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;

View File

@ -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`] = `

View File

@ -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();
}