Fix #92
This commit is contained in:
parent
1ef17c5d78
commit
783410390e
10
src/dfmt.d
10
src/dfmt.d
|
@ -954,6 +954,11 @@ private:
|
||||||
}
|
}
|
||||||
else if (currentIs(tok!"identifier") && peekIs(tok!":"))
|
else if (currentIs(tok!"identifier") && peekIs(tok!":"))
|
||||||
{
|
{
|
||||||
|
while ((peekBackIs(tok!"}", true) || peekBackIs(tok!";", true))
|
||||||
|
&& indents.length && isTempIndent(indents.top()))
|
||||||
|
{
|
||||||
|
indents.pop();
|
||||||
|
}
|
||||||
auto l = indents.indentToMostRecent(tok!"switch");
|
auto l = indents.indentToMostRecent(tok!"switch");
|
||||||
if (l != -1)
|
if (l != -1)
|
||||||
{
|
{
|
||||||
|
@ -970,6 +975,11 @@ private:
|
||||||
}
|
}
|
||||||
else if (currentIs(tok!"case") || currentIs(tok!"default"))
|
else if (currentIs(tok!"case") || currentIs(tok!"default"))
|
||||||
{
|
{
|
||||||
|
while ((peekBackIs(tok!"}", true) || peekBackIs(tok!";", true))
|
||||||
|
&& indents.length && isTempIndent(indents.top()))
|
||||||
|
{
|
||||||
|
indents.pop();
|
||||||
|
}
|
||||||
auto l = indents.indentToMostRecent(tok!"switch");
|
auto l = indents.indentToMostRecent(tok!"switch");
|
||||||
if (l != -1)
|
if (l != -1)
|
||||||
indentLevel = l;
|
indentLevel = l;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
switch (cast(uint) sz)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
if (!global.params.is64bit)
|
||||||
|
goto Lmemory;
|
||||||
|
case 4:
|
||||||
|
t1 = Type.tint32;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
switch (cast(uint) sz)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
if (!global.params.is64bit)
|
||||||
|
goto Lmemory;
|
||||||
|
case 4:
|
||||||
|
t1 = Type.tint32;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue