This commit is contained in:
Hackerpilot 2016-01-20 17:00:46 -08:00
parent 3c6ea77a12
commit db2ad1354b
4 changed files with 20 additions and 5 deletions

View file

@ -209,8 +209,7 @@ private:
else if ((isBlockHeader() || currentIs(tok!"version")
|| currentIs(tok!"debug")) && peekIs(tok!"(", false))
{
if (!assumeSorted(astInformation.constraintLocations)
.equalRange(current.index).empty)
if (!assumeSorted(astInformation.constraintLocations).equalRange(current.index).empty)
formatConstrtaint();
else
formatBlockHeader();
@ -365,7 +364,9 @@ private:
immutable canAddNewline = currTokenLine - prevTokenEndLine < 1;
if (peekBackIsOperator() && !isSeparationToken(t))
pushWrapIndent(t);
if (prevTokenEndLine == currTokenLine || (t == tok!")" && peekIs(tok!"{")))
if (peekBackIs(tok!")") && !canAddNewline && prevTokenEndLine < currTokenLine)
write(" ");
else if (prevTokenEndLine == currTokenLine || (t == tok!")" && peekIs(tok!"{")))
write(" ");
else if (canAddNewline || (peekIs(tok!"{") && t == tok!"}"))
newline();
@ -1157,8 +1158,7 @@ private:
newline();
}
else if (!peekIs(tok!"}") && (linebreakHints.canFind(index)
|| (linebreakHints.length == 0
&& currentLineLength > config.max_line_length)))
|| (linebreakHints.length == 0 && currentLineLength > config.max_line_length)))
{
pushWrapIndent();
writeToken();

View file

@ -0,0 +1,5 @@
unittest
{
static if (stuff) // comment
things();
}

6
tests/issue0221.d Normal file
View file

@ -0,0 +1,6 @@
unittest
{
static if (stuff)
// comment
things();
}

View file

@ -0,0 +1,4 @@
unittest {
static if (stuff) // comment
things();
}