Skip to content

Commit

Permalink
Format do like body after function attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
belka-ew authored and dlang-bot committed Jun 14, 2021
1 parent 821b9be commit 995c21a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/dfmt/formatter.d
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ private:
else
formatBlockHeader();
}
else if ((current.text == "body" || current == tok!"do") && peekBackIsFunctionDeclarationEnding())
{
formatKeyword();
}
else if (currentIs(tok!"do"))
{
formatBlockHeader();
Expand Down Expand Up @@ -321,10 +325,6 @@ private:
inlineElse = true;
formatKeyword();
}
else if (current.text == "body" && peekBackIsFunctionDeclarationEnding())
{
formatKeyword();
}
else if (isBasicType(current.type))
{
writeToken();
Expand Down
4 changes: 4 additions & 0 deletions tests/allman/issue0528.d.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
void f() return
do
{
}
4 changes: 4 additions & 0 deletions tests/issue0528.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
void f() return
do
{
}
3 changes: 3 additions & 0 deletions tests/otbs/issue0528.d.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
void f() return
do {
}

0 comments on commit 995c21a

Please sign in to comment.