Fix #90
This commit is contained in:
parent
0ae8eccc2f
commit
b07ecacb91
17
src/dfmt.d
17
src/dfmt.d
|
|
@ -426,15 +426,10 @@ private:
|
||||||
writeToken();
|
writeToken();
|
||||||
break;
|
break;
|
||||||
case tok!":":
|
case tok!":":
|
||||||
if (!assumeSorted(astInformation.attributeDeclarationLines)
|
if (!assumeSorted(astInformation.caseEndLocations)
|
||||||
.equalRange(current.line).empty)
|
.equalRange(current.index).empty || !assumeSorted(
|
||||||
{
|
astInformation.attributeDeclarationLines).equalRange(
|
||||||
writeToken();
|
current.line).empty)
|
||||||
tempIndent = 0;
|
|
||||||
newline();
|
|
||||||
}
|
|
||||||
else if (!assumeSorted(astInformation.caseEndLocations)
|
|
||||||
.equalRange(current.index).empty)
|
|
||||||
{
|
{
|
||||||
indentLevel++;
|
indentLevel++;
|
||||||
writeToken();
|
writeToken();
|
||||||
|
|
@ -1043,7 +1038,9 @@ private:
|
||||||
&& currentIs(tok!"identifier") && peekIs(tok!":")
|
&& currentIs(tok!"identifier") && peekIs(tok!":")
|
||||||
&& (!isBlockHeader(2) || peek2Is(tok!"if"))))
|
&& (!isBlockHeader(2) || peek2Is(tok!"if"))))
|
||||||
{
|
{
|
||||||
tempIndent--;
|
popIndent();
|
||||||
|
if (braceIndents.length)
|
||||||
|
indentLevel = braceIndents.top();
|
||||||
}
|
}
|
||||||
indent();
|
indent();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
L1:
|
||||||
|
switch (x)
|
||||||
|
{
|
||||||
|
case Case:
|
||||||
|
doSomething();
|
||||||
|
doSomethingElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
L1:
|
||||||
|
switch (x)
|
||||||
|
{
|
||||||
|
case Case:
|
||||||
|
doSomething();
|
||||||
|
doSomethingElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue