mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-05-03 16:49:56 +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
|
else
|
||||||
{
|
{
|
||||||
writeToken();
|
writeToken();
|
||||||
|
indents.popWrapIndents();
|
||||||
linebreakHints = [];
|
linebreakHints = [];
|
||||||
while (indents.topIs(tok!"enum"))
|
while (indents.topIs(tok!"enum"))
|
||||||
indents.pop();
|
indents.pop();
|
||||||
|
@ -1313,6 +1314,7 @@ private:
|
||||||
{
|
{
|
||||||
if (isWrapToken)
|
if (isWrapToken)
|
||||||
{
|
{
|
||||||
|
if (!indents.topIs(tok!"enum"))
|
||||||
pushWrapIndent();
|
pushWrapIndent();
|
||||||
write(" ");
|
write(" ");
|
||||||
writeToken();
|
writeToken();
|
||||||
|
@ -1330,6 +1332,7 @@ private:
|
||||||
{
|
{
|
||||||
if (isWrapToken)
|
if (isWrapToken)
|
||||||
{
|
{
|
||||||
|
if (!indents.topIs(tok!"enum"))
|
||||||
pushWrapIndent();
|
pushWrapIndent();
|
||||||
newline();
|
newline();
|
||||||
writeToken();
|
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