From cf32df2acba2a25307538fb498d8ffa6b76e7ed0 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Wed, 18 Mar 2015 16:22:04 -0700 Subject: [PATCH] Fix #117 --- src/dfmt.d | 4 ++-- tests/allman/issue0117.d.ref | 7 +++++++ tests/issue0117.d | 5 +++++ tests/otbs/issue0117.d.ref | 5 +++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 tests/allman/issue0117.d.ref create mode 100644 tests/issue0117.d create mode 100644 tests/otbs/issue0117.d.ref diff --git a/src/dfmt.d b/src/dfmt.d index c44c13a..62a76c7 100644 --- a/src/dfmt.d +++ b/src/dfmt.d @@ -746,8 +746,8 @@ private: case tok!"~": if (peekIs(tok!"this")) { - if (!(index == 0 || peekBackIs(tok!"{") || peekBackIs(tok!"}") - || peekBackIs(tok!";"))) + if (!(index == 0 || peekBackIs(tok!"{", true) || peekBackIs(tok!"}", true) + || peekBackIs(tok!";", true))) { write(" "); } diff --git a/tests/allman/issue0117.d.ref b/tests/allman/issue0117.d.ref new file mode 100644 index 0000000..76947e9 --- /dev/null +++ b/tests/allman/issue0117.d.ref @@ -0,0 +1,7 @@ +struct A +{ + int i; // Comment + ~this() + { + } +} diff --git a/tests/issue0117.d b/tests/issue0117.d new file mode 100644 index 0000000..fc09a09 --- /dev/null +++ b/tests/issue0117.d @@ -0,0 +1,5 @@ +struct A +{ + int i; // Comment + ~this() {} +} diff --git a/tests/otbs/issue0117.d.ref b/tests/otbs/issue0117.d.ref new file mode 100644 index 0000000..c0a96c0 --- /dev/null +++ b/tests/otbs/issue0117.d.ref @@ -0,0 +1,5 @@ +struct A { + int i; // Comment + ~this() { + } +}