mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-05-09 12:19:02 +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)
|
else if (!assumeSorted(astInformation.caseEndLocations)
|
||||||
.equalRange(current.index).empty)
|
.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++;
|
indentLevel++;
|
||||||
|
}
|
||||||
writeToken();
|
writeToken();
|
||||||
newline();
|
newline();
|
||||||
}
|
}
|
||||||
|
@ -843,8 +846,8 @@ private:
|
||||||
writeToken();
|
writeToken();
|
||||||
write(" ");
|
write(" ");
|
||||||
}
|
}
|
||||||
else if (peekIs(tok!"case") || peekIs(tok!"default")
|
else if (peekIs(tok!"case", false) || peekIs(tok!"default", false)
|
||||||
|| peekIs(tok!"}") || peekIsLabel())
|
|| peekIs(tok!"}", false) || peekIsLabel())
|
||||||
{
|
{
|
||||||
indentLevel = l;
|
indentLevel = l;
|
||||||
formatStep();
|
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