From 0fb80d7d5f813824ea4b929b79269cc6a14cb53d Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 22 Jun 2022 15:19:57 +0300 Subject: [PATCH] Update AstNodeUtils.kt --- .../cqfn/diktat/ruleset/utils/AstNodeUtils.kt | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt index 68357a46c8..be13f1b3fb 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt @@ -723,19 +723,6 @@ fun ASTNode.extractLineOfText(): String { return text.joinToString(separator = "").trim() } -/** - * @param pred a predicate - * @return filtered sequence - */ -private fun Sequence.takeWhileInclusive(pred: (T) -> Boolean): Sequence { - var shouldContinue = true - return takeWhile { - val result = shouldContinue - shouldContinue = pred(it) - result - } -} - /** * Checks node has `@Test` annotation */ @@ -846,6 +833,15 @@ fun ASTNode.takeByChainOfTypes(vararg types: IElementType): ASTNode? { return node } +private fun Sequence.takeWhileInclusive(pred: (T) -> Boolean): Sequence { + var shouldContinue = true + return takeWhile { + val result = shouldContinue + shouldContinue = pred(it) + result + } +} + private fun Collection.containSuppressWithName(name: String) = this.any { it.shortName.toString() == (Suppress::class.simpleName) &&