From 66342a99ee27c334d3c12f7373a69a19e88473cc Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Tue, 10 Mar 2015 14:33:27 -0700 Subject: [PATCH] Fix #89 --- src/dfmt.d | 2 +- tests/issue0089.d | 6 ++++++ tests/issue0089.d.ref | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/issue0089.d create mode 100644 tests/issue0089.d.ref 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(); +}