From 7c83d5df9396f35b4650765044ed9e4dce742e29 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Thu, 14 Feb 2019 17:59:05 +0300 Subject: [PATCH] Move queue back to class instance after bad refactoring in search package Relevant commit: 7f1e7cc4619e8f323facee60fd0e6f473471d855 --- .../jetbrains/kotlin/idea/search/KotlinIndexers.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexers.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexers.kt index 11c17ce1edd..7a3bff25981 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexers.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexers.kt @@ -50,17 +50,17 @@ private val ALL_SEARCHABLE_OPERATIONS: ImmutableSet = ImmutableSet class KotlinFilterLexer(private val occurrenceConsumer: OccurrenceConsumer) : BaseFilterLexer(KotlinLexer(), occurrenceConsumer) { private companion object { - private val codeTokens = TokenSet.orSet( + private val CODE_TOKENS = TokenSet.orSet( TokenSet.create(*ALL_SEARCHABLE_OPERATIONS.toTypedArray()), TokenSet.create(KtTokens.IDENTIFIER) ) - private val commentTokens = TokenSet.orSet(KtTokens.COMMENTS, TokenSet.create(KDocTokens.KDOC)) - + private val COMMENT_TOKENS = TokenSet.orSet(KtTokens.COMMENTS, TokenSet.create(KDocTokens.KDOC)) private const val MAX_PREV_TOKENS = 2 - private val prevTokens = ArrayDeque(MAX_PREV_TOKENS) } + private val prevTokens = ArrayDeque(MAX_PREV_TOKENS) + private var prevTokenStart = -1 private var prevTokenEnd = -1 @@ -107,17 +107,17 @@ class KotlinFilterLexer(private val occurrenceConsumer: OccurrenceConsumer) : Ba } } - in codeTokens -> addOccurrenceInToken(UsageSearchContext.IN_CODE.toInt()) + in CODE_TOKENS -> addOccurrenceInToken(UsageSearchContext.IN_CODE.toInt()) in KtTokens.STRINGS -> scanWordsInToken(UsageSearchContext.IN_STRINGS + UsageSearchContext.IN_FOREIGN_LANGUAGES, false, true) - in commentTokens -> { + in COMMENT_TOKENS -> { scanWordsInToken(UsageSearchContext.IN_COMMENTS.toInt(), false, false) advanceTodoItemCountsInToken() } } - if (tokenType != TokenType.WHITE_SPACE && tokenType !in commentTokens) { + if (tokenType != TokenType.WHITE_SPACE && tokenType !in COMMENT_TOKENS) { if (prevTokens.size == MAX_PREV_TOKENS) { prevTokens.removeLast() }