mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-04-25 21:00:03 +03:00
Fix #286 - Weird indentation in else branch after wrapping expression merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
parent
886903f8ea
commit
16c3811261
4 changed files with 48 additions and 2 deletions
|
@ -730,6 +730,7 @@ private:
|
|||
else
|
||||
{
|
||||
writeToken();
|
||||
indents.popWrapIndents();
|
||||
linebreakHints = [];
|
||||
while (indents.topIs(tok!"enum"))
|
||||
indents.pop();
|
||||
|
@ -1313,7 +1314,8 @@ private:
|
|||
{
|
||||
if (isWrapToken)
|
||||
{
|
||||
pushWrapIndent();
|
||||
if (!indents.topIs(tok!"enum"))
|
||||
pushWrapIndent();
|
||||
write(" ");
|
||||
writeToken();
|
||||
newline();
|
||||
|
@ -1330,7 +1332,8 @@ private:
|
|||
{
|
||||
if (isWrapToken)
|
||||
{
|
||||
pushWrapIndent();
|
||||
if (!indents.topIs(tok!"enum"))
|
||||
pushWrapIndent();
|
||||
newline();
|
||||
writeToken();
|
||||
}
|
||||
|
|
16
tests/allman/issue0286.d.ref
Normal file
16
tests/allman/issue0286.d.ref
Normal file
|
@ -0,0 +1,16 @@
|
|||
void foo()
|
||||
{
|
||||
if (true)
|
||||
enum vectorizeable = aLongExpressionThatCausesWrapping()
|
||||
&& aLongExpressionThatCausesWrapping();
|
||||
else
|
||||
enum vectorizeable = false;
|
||||
|
||||
if (true)
|
||||
{
|
||||
enum vectorizeable = aLongExpressionThatCausesWrapping()
|
||||
&& aLongExpressionThatCausesWrapping();
|
||||
}
|
||||
else
|
||||
enum vectorizeable = false;
|
||||
}
|
14
tests/issue0286.d
Normal file
14
tests/issue0286.d
Normal file
|
@ -0,0 +1,14 @@
|
|||
void foo()
|
||||
{
|
||||
if (true)
|
||||
enum vectorizeable = aLongExpressionThatCausesWrapping()
|
||||
&& aLongExpressionThatCausesWrapping();
|
||||
else
|
||||
enum vectorizeable = false;
|
||||
|
||||
if (true){
|
||||
enum vectorizeable = aLongExpressionThatCausesWrapping()
|
||||
&& aLongExpressionThatCausesWrapping();}
|
||||
else
|
||||
enum vectorizeable = false;
|
||||
}
|
13
tests/otbs/issue0286.d.ref
Normal file
13
tests/otbs/issue0286.d.ref
Normal file
|
@ -0,0 +1,13 @@
|
|||
void foo() {
|
||||
if (true)
|
||||
enum vectorizeable = aLongExpressionThatCausesWrapping()
|
||||
&& aLongExpressionThatCausesWrapping();
|
||||
else
|
||||
enum vectorizeable = false;
|
||||
|
||||
if (true) {
|
||||
enum vectorizeable = aLongExpressionThatCausesWrapping()
|
||||
&& aLongExpressionThatCausesWrapping();
|
||||
} else
|
||||
enum vectorizeable = false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue