mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-04-29 06:39:55 +03:00
Fix #433
This commit is contained in:
parent
436d157b4f
commit
2cc1f59235
4 changed files with 23 additions and 0 deletions
|
@ -448,6 +448,8 @@ private:
|
||||||
write(" ");
|
write(" ");
|
||||||
else if (prevTokenEndLine == currTokenLine || (t == tok!")" && peekIs(tok!"{")))
|
else if (prevTokenEndLine == currTokenLine || (t == tok!")" && peekIs(tok!"{")))
|
||||||
write(" ");
|
write(" ");
|
||||||
|
else if (t == tok!"else")
|
||||||
|
write(" ");
|
||||||
else if (canAddNewline || (peekIs(tok!"{") && t == tok!"}"))
|
else if (canAddNewline || (peekIs(tok!"{") && t == tok!"}"))
|
||||||
newline();
|
newline();
|
||||||
}
|
}
|
||||||
|
|
7
tests/allman/issue0433.d.ref
Normal file
7
tests/allman/issue0433.d.ref
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
int abs(int x)
|
||||||
|
{
|
||||||
|
if (x < 0) // x negative, must negate
|
||||||
|
return -x;
|
||||||
|
else // x already non-negative, just return it
|
||||||
|
return x;
|
||||||
|
}
|
8
tests/issue0433.d
Normal file
8
tests/issue0433.d
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
int abs(int x) {
|
||||||
|
if (x < 0)
|
||||||
|
// x negative, must negate
|
||||||
|
return -x;
|
||||||
|
else
|
||||||
|
// x already non-negative, just return it
|
||||||
|
return x;
|
||||||
|
}
|
6
tests/otbs/issue0433.d.ref
Normal file
6
tests/otbs/issue0433.d.ref
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
int abs(int x) {
|
||||||
|
if (x < 0) // x negative, must negate
|
||||||
|
return -x;
|
||||||
|
else // x already non-negative, just return it
|
||||||
|
return x;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue