Fix #209
This commit is contained in:
parent
382258eb97
commit
bab1a5f592
|
|
@ -431,6 +431,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void formatLeftParenOrBracket()
|
void formatLeftParenOrBracket()
|
||||||
|
in
|
||||||
|
{
|
||||||
|
assert(currentIs(tok!"(") || currentIs(tok!"["));
|
||||||
|
}
|
||||||
|
body
|
||||||
{
|
{
|
||||||
immutable p = tokens[index].type;
|
immutable p = tokens[index].type;
|
||||||
regenLineBreakHintsIfNecessary(index);
|
regenLineBreakHintsIfNecessary(index);
|
||||||
|
|
@ -464,15 +469,18 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void formatRightParen()
|
void formatRightParen()
|
||||||
|
in
|
||||||
|
{
|
||||||
|
assert(currentIs(tok!")"));
|
||||||
|
}
|
||||||
|
body
|
||||||
{
|
{
|
||||||
parenDepth--;
|
parenDepth--;
|
||||||
if (parenDepth == 0)
|
if (parenDepth == 0)
|
||||||
indents.popWrapIndents();
|
indents.popWrapIndents();
|
||||||
if (parenDepth == 0 && (currentIs(tok!"out") || currentIs(tok!"body")))
|
|
||||||
{
|
if (parenDepth == 0 && (peekIs(tok!"in") || peekIs(tok!"out") || peekIs(tok!"body")))
|
||||||
writeToken();
|
writeToken();
|
||||||
newline();
|
|
||||||
}
|
|
||||||
else if (peekIsLiteralOrIdent() || peekIsBasicType())
|
else if (peekIsLiteralOrIdent() || peekIsBasicType())
|
||||||
{
|
{
|
||||||
writeToken();
|
writeToken();
|
||||||
|
|
@ -770,7 +778,9 @@ private:
|
||||||
if (!currentIs(tok!"{") && !currentIs(tok!";"))
|
if (!currentIs(tok!"{") && !currentIs(tok!";"))
|
||||||
write(" ");
|
write(" ");
|
||||||
}
|
}
|
||||||
else if (!currentIs(tok!"{") && !currentIs(tok!";"))
|
else if (!currentIs(tok!"{") && !currentIs(tok!";")
|
||||||
|
&& !currentIs(tok!"in") && !currentIs(tok!"out")
|
||||||
|
&& !currentIs(tok!"body"))
|
||||||
newline();
|
newline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -835,7 +845,10 @@ private:
|
||||||
case tok!"in":
|
case tok!"in":
|
||||||
immutable isContract = astInformation.contractLocations.canFindIndex(current.index);
|
immutable isContract = astInformation.contractLocations.canFindIndex(current.index);
|
||||||
if (isContract)
|
if (isContract)
|
||||||
|
{
|
||||||
|
indents.popTempIndents();
|
||||||
newline();
|
newline();
|
||||||
|
}
|
||||||
else if (!peekBackIsOneOf(false, tok!"(", tok!",", tok!"!"))
|
else if (!peekBackIsOneOf(false, tok!"(", tok!",", tok!"!"))
|
||||||
write(" ");
|
write(" ");
|
||||||
writeToken();
|
writeToken();
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -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 {
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue