mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-04-25 21:00:03 +03:00
Fix #49
This commit is contained in:
parent
49633c8901
commit
b989388e7c
3 changed files with 30 additions and 3 deletions
|
@ -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
12
tests/issue0049.d
Normal 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
12
tests/issue0049.d.ref
Normal file
|
@ -0,0 +1,12 @@
|
|||
void main(string[] args)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
return null;
|
||||
case 1:
|
||||
// Indented comment
|
||||
/* fall through */
|
||||
default:
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue