This commit is contained in:
Hackerpilot 2015-03-07 14:47:02 -08:00
parent 49633c8901
commit b989388e7c
3 changed files with 30 additions and 3 deletions

View file

@ -428,8 +428,11 @@ private:
else if (!assumeSorted(astInformation.caseEndLocations)
.equalRange(current.index).empty)
{
if (!(peekIs(tok!"case") || peekIs(tok!"default") || peekIsLabel()))
if (!(peekIs(tok!"case", false) || peekIs(tok!"default", false)
|| peekIs(tok!"}") || peekIsLabel()))
{
indentLevel++;
}
writeToken();
newline();
}
@ -843,8 +846,8 @@ private:
writeToken();
write(" ");
}
else if (peekIs(tok!"case") || peekIs(tok!"default")
|| peekIs(tok!"}") || peekIsLabel())
else if (peekIs(tok!"case", false) || peekIs(tok!"default", false)
|| peekIs(tok!"}", false) || peekIsLabel())
{
indentLevel = l;
formatStep();

12
tests/issue0049.d Normal file
View file

@ -0,0 +1,12 @@
void main(string[] args)
{
switch (value)
{
case 0:
return null;
case 1:
// Indented comment
/* fall through */
default:
}
}

12
tests/issue0049.d.ref Normal file
View file

@ -0,0 +1,12 @@
void main(string[] args)
{
switch (value)
{
case 0:
return null;
case 1:
// Indented comment
/* fall through */
default:
}
}