This commit is contained in:
Hackerpilot 2015-03-07 18:30:19 -08:00
parent 3743e80505
commit 85247f77f7
3 changed files with 53 additions and 5 deletions

View File

@ -816,6 +816,12 @@ private:
writeToken(); // switch writeToken(); // switch
write(" "); write(" ");
writeParens(true); writeParens(true);
if (current.type == tok!"with")
{
writeToken();
write(" ");
writeParens(true);
}
if (current.type != tok!"{") if (current.type != tok!"{")
return; return;
if (config.braceStyle == BraceStyle.otbs) if (config.braceStyle == BraceStyle.otbs)
@ -853,12 +859,27 @@ private:
writeToken(); writeToken();
write(" "); write(" ");
} }
else if (current.type == tok!":" && peekIs(tok!"..")) else if (current.type == tok!":")
{ {
writeToken(); if (peekIs(tok!".."))
write(" "); {
writeToken(); writeToken();
write(" "); write(" ");
writeToken();
write(" ");
}
else if (peekIs(tok!"identifier") && peek2Is(tok!":"))
{
writeToken();
indentLevel++;
newline();
writeToken();
writeToken();
indentLevel++;
newline();
}
else
goto peek;
} }
else else
{ {

12
tests/issue0043.d Normal file
View File

@ -0,0 +1,12 @@
unittest
{
switch (something) with (stuff){
case 1: case 2:
label:doStuff();
case 3:
doOtherSTuff();
goto label;
default:
break;
}
}

15
tests/issue0043.d.ref Normal file
View File

@ -0,0 +1,15 @@
unittest
{
switch (something) with (stuff)
{
case 1:
case 2:
label:
doStuff();
case 3:
doOtherSTuff();
goto label;
default:
break;
}
}