This commit is contained in:
Hackerpilot 2015-04-24 13:15:53 -07:00
parent d52ffd5ac0
commit 7109c5b4f2
4 changed files with 27 additions and 4 deletions

View File

@ -154,8 +154,7 @@ private:
{ {
immutable t = tokens[index].type; immutable t = tokens[index].type;
if (t == tok!"identifier" || isStringLiteral(t) if (t == tok!"identifier" || isStringLiteral(t)
|| isNumberLiteral(t) || t == tok!"characterLiteral" || isNumberLiteral(t) || t == tok!"characterLiteral")
|| isKeyword(t))
write(" "); write(" ");
} }
} }
@ -221,7 +220,7 @@ private:
{ {
writeToken(); writeToken();
if (index < tokens.length && (currentIs(tok!"identifier") if (index < tokens.length && (currentIs(tok!"identifier")
|| isKeyword(current.type) || isBasicType(current.type) || currentIs(tok!"@"))) || isBasicType(current.type) || currentIs(tok!"@")))
{ {
write(" "); write(" ");
} }
@ -377,7 +376,7 @@ private:
newline(); newline();
writeToken(); // in/out/body writeToken(); // in/out/body
} }
else if (peekIsLiteralOrIdent() || peekIsBasicType() || peekIsKeyword()) else if (peekIsLiteralOrIdent() || peekIsBasicType())
{ {
writeToken(); writeToken();
if (spaceAfterParens || parenDepth > 0) if (spaceAfterParens || parenDepth > 0)
@ -676,6 +675,8 @@ private:
break; break;
case tok!"in": case tok!"in":
case tok!"is": case tok!"is":
if (!peekBackIsOneOf(false, tok!"!", tok!"(", tok!","))
write(" ");
writeToken(); writeToken();
if (!currentIs(tok!"(") && !currentIs(tok!"{")) if (!currentIs(tok!"(") && !currentIs(tok!"{"))
write(" "); write(" ");

View File

@ -0,0 +1,8 @@
unittest
{
auto result = a[0] in aa;
}
void doStuff(in int a, in int b)
{
}

8
tests/issue0138.d Normal file
View File

@ -0,0 +1,8 @@
unittest
{
auto result = a[0] in aa;
}
void doStuff(in int a, in int b)
{
}

View File

@ -0,0 +1,6 @@
unittest {
auto result = a[0] in aa;
}
void doStuff(in int a, in int b) {
}