[SLC] SymbolLightSimpleMethod: reduce allocations number

^KTIJ-23783
This commit is contained in:
Dmitrii Gridin
2022-12-05 19:45:22 +01:00
committed by Space Team
parent c5c79a5fb5
commit 91586705b3
2 changed files with 8 additions and 5 deletions
@@ -6,6 +6,8 @@
package org.jetbrains.kotlin.light.classes.symbol.methods
import com.intellij.psi.*
import kotlinx.collections.immutable.PersistentMap
import kotlinx.collections.immutable.mutate
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.symbols.KtFunctionSymbol
import org.jetbrains.kotlin.analysis.api.types.KtType
@@ -138,10 +140,11 @@ internal class SymbolLightSimpleMethod(
}
}
private fun modifiersForInlineOnlyCase(): Map<String, Boolean> =
LazyModifiersBox.MODALITY_MODIFIERS_MAP.putAll(LazyModifiersBox.VISIBILITY_MODIFIERS_MAP)
.with(PsiModifier.FINAL)
.with(PsiModifier.PRIVATE)
private fun modifiersForInlineOnlyCase(): PersistentMap<String, Boolean> = LazyModifiersBox.MODALITY_MODIFIERS_MAP.mutate {
it.putAll(LazyModifiersBox.VISIBILITY_MODIFIERS_MAP)
it[PsiModifier.FINAL] = true
it[PsiModifier.PRIVATE] = true
}
private val hasInlineOnlyAnnotation: Boolean by lazyPub { withFunctionSymbol { it.hasInlineOnlyAnnotation() } }
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.psi.KtModifierListOwner
import org.jetbrains.kotlin.utils.keysToMap
import java.util.concurrent.atomic.AtomicReference
internal open class SymbolLightModifierList<out T : KtLightElement<KtModifierListOwner, PsiModifierListOwner>> :
internal sealed class SymbolLightModifierList<out T : KtLightElement<KtModifierListOwner, PsiModifierListOwner>> :
KtLightElementBase, PsiModifierList, KtLightElement<KtModifierList, PsiModifierListOwner> {
protected val owner: T
private val staticModifiers: Set<String>?