Fix #34 for realz

This commit is contained in:
Hackerpilot 2015-03-05 19:51:44 -08:00
parent 6f153bd8a1
commit 21515ef614
3 changed files with 29 additions and 2 deletions

View File

@ -661,6 +661,7 @@ private:
.equalRange(tokens[index].index).length && !peekIs(tok!"}"))
{
output.put("\n");
justAddedExtraNewline = true;
}
if (config.braceStyle == BraceStyle.otbs)
{
@ -909,8 +910,8 @@ private:
import std.range:assumeSorted;
output.put("\n");
immutable bool hasCurrent = index + 1 < tokens.length;
if (index > 0 && hasCurrent && tokens[index - 1].type != tok!"}"
&& tokens[index].line - tokens[index - 1].line > 1 && !justAddedExtraNewline)
if (!justAddedExtraNewline && index > 0
&& hasCurrent && tokens[index].line - tokens[index - 1].line > 1)
{
output.put("\n");
}

14
tests/issue0034.d Normal file
View File

@ -0,0 +1,14 @@
unittest
{
if (a.value == 0)
{
if (a.negative)
return SignExtendedNumber(value == 0 && negative);
else
return extreme(negative);
}
uinteger_t aAbs = copySign(a.value, a.negative);
}

12
tests/issue0034.d.ref Normal file
View File

@ -0,0 +1,12 @@
unittest
{
if (a.value == 0)
{
if (a.negative)
return SignExtendedNumber(value == 0 && negative);
else
return extreme(negative);
}
uinteger_t aAbs = copySign(a.value, a.negative);
}