diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 0a355db..1165fcb 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -274,6 +274,10 @@ private: else formatBlockHeader(); } + else if ((current.text == "body" || current == tok!"do") && peekBackIsFunctionDeclarationEnding()) + { + formatKeyword(); + } else if (currentIs(tok!"do")) { formatBlockHeader(); @@ -321,10 +325,6 @@ private: inlineElse = true; formatKeyword(); } - else if (current.text == "body" && peekBackIsFunctionDeclarationEnding()) - { - formatKeyword(); - } else if (isBasicType(current.type)) { writeToken(); diff --git a/tests/allman/issue0528.d.ref b/tests/allman/issue0528.d.ref new file mode 100644 index 0000000..3592591 --- /dev/null +++ b/tests/allman/issue0528.d.ref @@ -0,0 +1,4 @@ +void f() return +do +{ +} diff --git a/tests/issue0528.d b/tests/issue0528.d new file mode 100644 index 0000000..3592591 --- /dev/null +++ b/tests/issue0528.d @@ -0,0 +1,4 @@ +void f() return +do +{ +} diff --git a/tests/otbs/issue0528.d.ref b/tests/otbs/issue0528.d.ref new file mode 100644 index 0000000..304b696 --- /dev/null +++ b/tests/otbs/issue0528.d.ref @@ -0,0 +1,3 @@ +void f() return +do { +}