From b137580b596b55b2f42fcfa5b1f669ded52e55b6 Mon Sep 17 00:00:00 2001 From: Maximiliano Jabase Date: Fri, 11 Nov 2022 15:06:09 -0300 Subject: [PATCH] more code cleanups --- .../SourcepawnCondenser/Condenser.cs | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/SourcepawnCondenser/SourcepawnCondenser/Condenser.cs b/SourcepawnCondenser/SourcepawnCondenser/Condenser.cs index 16f94d1..9c78f55 100644 --- a/SourcepawnCondenser/SourcepawnCondenser/Condenser.cs +++ b/SourcepawnCondenser/SourcepawnCondenser/Condenser.cs @@ -68,22 +68,15 @@ private int BacktraceTestForToken(int startPosition, TokenKind testKind, bool ig { for (var i = startPosition; i >= 0; --i) { - if (_tokens[i].Kind == testKind) - { - return i; - } - - if (ignoreOtherTokens) + if (ignoreOtherTokens || (_tokens[i].Kind == TokenKind.EOL && ignoreEol)) { continue; } - if (_tokens[i].Kind == TokenKind.EOL && ignoreEol) + if (_tokens[i].Kind == testKind) { - continue; + return i; } - - return -1; } return -1; @@ -93,22 +86,15 @@ private int FortraceTestForToken(int startPosition, TokenKind testKind, bool ign { for (var i = startPosition; i < _length; ++i) { - if (_tokens[i].Kind == testKind) - { - return i; - } - - if (ignoreOtherTokens) + if (ignoreOtherTokens || (_tokens[i].Kind == TokenKind.EOL && ignoreEol)) { continue; } - if (_tokens[i].Kind == TokenKind.EOL && ignoreEol) + if (_tokens[i].Kind == testKind) { - continue; + return i; } - - return -1; } return -1;