mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-04-25 21:00:03 +03:00
Fix #90
This commit is contained in:
parent
0ae8eccc2f
commit
b07ecacb91
3 changed files with 27 additions and 10 deletions
17
src/dfmt.d
17
src/dfmt.d
|
@ -426,15 +426,10 @@ private:
|
|||
writeToken();
|
||||
break;
|
||||
case tok!":":
|
||||
if (!assumeSorted(astInformation.attributeDeclarationLines)
|
||||
.equalRange(current.line).empty)
|
||||
{
|
||||
writeToken();
|
||||
tempIndent = 0;
|
||||
newline();
|
||||
}
|
||||
else if (!assumeSorted(astInformation.caseEndLocations)
|
||||
.equalRange(current.index).empty)
|
||||
if (!assumeSorted(astInformation.caseEndLocations)
|
||||
.equalRange(current.index).empty || !assumeSorted(
|
||||
astInformation.attributeDeclarationLines).equalRange(
|
||||
current.line).empty)
|
||||
{
|
||||
indentLevel++;
|
||||
writeToken();
|
||||
|
@ -1043,7 +1038,9 @@ private:
|
|||
&& currentIs(tok!"identifier") && peekIs(tok!":")
|
||||
&& (!isBlockHeader(2) || peek2Is(tok!"if"))))
|
||||
{
|
||||
tempIndent--;
|
||||
popIndent();
|
||||
if (braceIndents.length)
|
||||
indentLevel = braceIndents.top();
|
||||
}
|
||||
indent();
|
||||
}
|
||||
|
|
10
tests/issue0090.d
Normal file
10
tests/issue0090.d
Normal file
|
@ -0,0 +1,10 @@
|
|||
unittest
|
||||
{
|
||||
L1:
|
||||
switch (x)
|
||||
{
|
||||
case Case:
|
||||
doSomething();
|
||||
doSomethingElse();
|
||||
}
|
||||
}
|
10
tests/issue0090.d.ref
Normal file
10
tests/issue0090.d.ref
Normal file
|
@ -0,0 +1,10 @@
|
|||
unittest
|
||||
{
|
||||
L1:
|
||||
switch (x)
|
||||
{
|
||||
case Case:
|
||||
doSomething();
|
||||
doSomethingElse();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue