This commit is contained in:
Hackerpilot 2016-01-15 18:01:48 -08:00
parent 382258eb97
commit bab1a5f592
4 changed files with 80 additions and 5 deletions

View file

@ -431,6 +431,11 @@ private:
}
void formatLeftParenOrBracket()
in
{
assert(currentIs(tok!"(") || currentIs(tok!"["));
}
body
{
immutable p = tokens[index].type;
regenLineBreakHintsIfNecessary(index);
@ -464,15 +469,18 @@ private:
}
void formatRightParen()
in
{
assert(currentIs(tok!")"));
}
body
{
parenDepth--;
if (parenDepth == 0)
indents.popWrapIndents();
if (parenDepth == 0 && (currentIs(tok!"out") || currentIs(tok!"body")))
{
if (parenDepth == 0 && (peekIs(tok!"in") || peekIs(tok!"out") || peekIs(tok!"body")))
writeToken();
newline();
}
else if (peekIsLiteralOrIdent() || peekIsBasicType())
{
writeToken();
@ -770,7 +778,9 @@ private:
if (!currentIs(tok!"{") && !currentIs(tok!";"))
write(" ");
}
else if (!currentIs(tok!"{") && !currentIs(tok!";"))
else if (!currentIs(tok!"{") && !currentIs(tok!";")
&& !currentIs(tok!"in") && !currentIs(tok!"out")
&& !currentIs(tok!"body"))
newline();
}
@ -835,7 +845,10 @@ private:
case tok!"in":
immutable isContract = astInformation.contractLocations.canFindIndex(current.index);
if (isContract)
{
indents.popTempIndents();
newline();
}
else if (!peekBackIsOneOf(false, tok!"(", tok!",", tok!"!"))
write(" ");
writeToken();

View file

@ -0,0 +1,23 @@
unittest
{
{
public Vector!(T) opBinary(string op, string file = __FILE__, size_t line = __LINE__)(
const Vector!(T) x) const if (op == "*")
in
{
}
body
{
}
}
}
public Vector!(T) opBinary(string op, string file = __FILE__, size_t line = __LINE__)(
const Vector!(T) x) const if (op == "*")
in
{
}
body
{
}

21
tests/issue0209.d Normal file
View file

@ -0,0 +1,21 @@
unittest
{
{
public Vector!(T) opBinary(string op, string file = __FILE__, size_t line = __LINE__)(const Vector!(T) x) const if (op == "*")
in
{
}
body
{
}
}
}
public Vector!(T) opBinary(string op, string file = __FILE__, size_t line = __LINE__)(const Vector!(T) x) const if (op == "*")
in
{
}
body
{
}

View file

@ -0,0 +1,18 @@
unittest {
{
public Vector!(T) opBinary(string op, string file = __FILE__, size_t line = __LINE__)(
const Vector!(T) x) const if (op == "*")
in {
}
body {
}
}
}
public Vector!(T) opBinary(string op, string file = __FILE__, size_t line = __LINE__)(
const Vector!(T) x) const if (op == "*")
in {
}
body {
}