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