diff --git a/src/dfmt.d b/src/dfmt.d index 87b7e37..3470fd9 100644 --- a/src/dfmt.d +++ b/src/dfmt.d @@ -474,7 +474,7 @@ private: case tok!";": if (peekIs(tok!"else") && ifIndents.length) tempIndent = ifIndents.top(); - else if (!peekIs(tok!"}")) + else if (!peekIs(tok!"}") || peekIs(tok!"comment", false)) { if (ifIndents.length) { diff --git a/tests/issue0089.d b/tests/issue0089.d new file mode 100644 index 0000000..662cc91 --- /dev/null +++ b/tests/issue0089.d @@ -0,0 +1,6 @@ +unittest +{ + if (x) + doSomething(); + //doSomethingElse(); +} diff --git a/tests/issue0089.d.ref b/tests/issue0089.d.ref new file mode 100644 index 0000000..31e5965 --- /dev/null +++ b/tests/issue0089.d.ref @@ -0,0 +1,6 @@ +unittest +{ + if (x) + doSomething(); + //doSomethingElse(); +}