mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-04-25 21:00:03 +03:00
Fix #189
This commit is contained in:
parent
ac17371c10
commit
a9426cb44f
4 changed files with 59 additions and 5 deletions
|
@ -431,11 +431,10 @@ private:
|
|||
parenDepth--;
|
||||
if (parenDepth == 0)
|
||||
indents.popWrapIndents();
|
||||
if (parenDepth == 0 && (peekIs(tok!"in") || peekIs(tok!"out") || peekIs(tok!"body")))
|
||||
if (parenDepth == 0 && (currentIs(tok!"out") || currentIs(tok!"body")))
|
||||
{
|
||||
writeToken(); // )
|
||||
writeToken();
|
||||
newline();
|
||||
writeToken(); // in/out/body
|
||||
}
|
||||
else if (peekIsLiteralOrIdent() || peekIsBasicType())
|
||||
{
|
||||
|
@ -443,7 +442,7 @@ private:
|
|||
if (spaceAfterParens || parenDepth > 0)
|
||||
write(" ");
|
||||
}
|
||||
else if ((peekIsKeyword() || peekIs(tok!"@")) && spaceAfterParens)
|
||||
else if ((peekIsKeyword() || peekIs(tok!"@")) && spaceAfterParens && !peekIs(tok!"in"))
|
||||
{
|
||||
writeToken();
|
||||
write(" ");
|
||||
|
@ -791,7 +790,13 @@ private:
|
|||
write(" ");
|
||||
writeToken();
|
||||
if (!isContract)
|
||||
write(" ");
|
||||
{
|
||||
if (config.dfmt_brace_style == BraceStyle.allman)
|
||||
newline();
|
||||
else
|
||||
write(" ");
|
||||
}
|
||||
|
||||
break;
|
||||
case tok!"is":
|
||||
if (!peekBackIsOneOf(false, tok!"!", tok!"(", tok!",", tok!"}", tok!"=",
|
||||
|
|
21
tests/allman/issue0189.d.ref
Normal file
21
tests/allman/issue0189.d.ref
Normal file
|
@ -0,0 +1,21 @@
|
|||
unittest
|
||||
{
|
||||
Test("Something") in
|
||||
{
|
||||
abcde_abcde_abcde();
|
||||
abcde_abcde_abcde();
|
||||
abcde_abcde_abcde();
|
||||
abcde_abcde_abcde();
|
||||
abcde_abcde_abcde();
|
||||
abcde_abcde_abcde();
|
||||
};
|
||||
}
|
||||
|
||||
void aFunction(ParamType param)
|
||||
in
|
||||
{
|
||||
assert(stuff);
|
||||
}
|
||||
body
|
||||
{
|
||||
}
|
11
tests/issue0189.d
Normal file
11
tests/issue0189.d
Normal file
|
@ -0,0 +1,11 @@
|
|||
unittest
|
||||
{
|
||||
Test("Something") in { abcde_abcde_abcde(); abcde_abcde_abcde();abcde_abcde_abcde();abcde_abcde_abcde();abcde_abcde_abcde();abcde_abcde_abcde();};
|
||||
}
|
||||
|
||||
void aFunction(ParamType param)
|
||||
in
|
||||
{
|
||||
assert (stuff);
|
||||
}
|
||||
body{}
|
17
tests/otbs/issue0189.d.ref
Normal file
17
tests/otbs/issue0189.d.ref
Normal file
|
@ -0,0 +1,17 @@
|
|||
unittest {
|
||||
Test("Something") in {
|
||||
abcde_abcde_abcde();
|
||||
abcde_abcde_abcde();
|
||||
abcde_abcde_abcde();
|
||||
abcde_abcde_abcde();
|
||||
abcde_abcde_abcde();
|
||||
abcde_abcde_abcde();
|
||||
};
|
||||
}
|
||||
|
||||
void aFunction(ParamType param)
|
||||
in {
|
||||
assert(stuff);
|
||||
}
|
||||
body {
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue