From 95905cdbf1de94b6e83ad822f3db50eb58c6dc3c Mon Sep 17 00:00:00 2001 From: Stefan Koch Date: Tue, 27 Feb 2018 09:20:53 +0100 Subject: [PATCH] Simplify indentStack code --- src/dfmt/indentation.d | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dfmt/indentation.d b/src/dfmt/indentation.d index e009d12..8eeacea 100644 --- a/src/dfmt/indentation.d +++ b/src/dfmt/indentation.d @@ -68,7 +68,13 @@ struct IndentStack void push(IdType item) pure nothrow { arr[index] = item; - index = index + 1 == arr.length ? index : index + 1; + //FIXME this is actually a bad thing to do, + //we should not just override when the stack is + //at it's limit + if (index < arr.length) + { + index++; + } } /** @@ -76,7 +82,8 @@ struct IndentStack */ void pop() pure nothrow { - index = index == 0 ? index : index - 1; + if (index) + index--; } /**