Fix #208
This commit is contained in:
parent
f14c6e1226
commit
382258eb97
|
|
@ -949,8 +949,7 @@ private:
|
|||
formatAt();
|
||||
break;
|
||||
case tok!"!":
|
||||
if ((peekIs(tok!"is") || peekIs(tok!"in"))
|
||||
&& !peekBackIsOneOf(false, tok!"(", tok!"="))
|
||||
if ((peekIs(tok!"is") || peekIs(tok!"in")) && !peekBackIsOperator())
|
||||
write(" ");
|
||||
goto case;
|
||||
case tok!"...":
|
||||
|
|
@ -1488,7 +1487,7 @@ const pure @safe @nogc:
|
|||
return peekImplementation(tokenType, -1, ignoreComments);
|
||||
}
|
||||
|
||||
bool peekBackIsKeyword(bool ignoreComments = true)
|
||||
bool peekBackIsKeyword(bool ignoreComments = true) pure nothrow const @nogc @safe
|
||||
{
|
||||
if (index == 0)
|
||||
return false;
|
||||
|
|
@ -1503,6 +1502,11 @@ const pure @safe @nogc:
|
|||
return isKeyword(tokens[i].type);
|
||||
}
|
||||
|
||||
bool peekBackIsOperator() pure nothrow const @nogc @safe
|
||||
{
|
||||
return index == 0 ? false : isOperator(tokens[index - 1].type);
|
||||
}
|
||||
|
||||
bool peekBackIsOneOf(bool ignoreComments, IdType[] tokenTypes...)
|
||||
{
|
||||
if (index == 0)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
unittest
|
||||
{
|
||||
if (a && !is(b == q))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
unittest
|
||||
{
|
||||
if (a && !is(b == q))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
unittest {
|
||||
if (a && !is(b == q)) {
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue