Reduce allocations in KotlinTarget and modifier checkers

This commit is contained in:
Ivan Kochurkin
2021-08-05 18:28:35 +03:00
committed by TeamCityServer
parent 2c1c24c042
commit f2ffead881
3 changed files with 34 additions and 21 deletions
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget.*
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.lexer.KtKeywordToken
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
@@ -206,10 +205,10 @@ object ModifierCheckerCore {
isCompanionObject = parentDescriptor.isCompanionObject,
isLocalClass = DescriptorUtils.isLocal(parentDescriptor)
)
is PropertySetterDescriptor -> listOf(PROPERTY_SETTER)
is PropertyGetterDescriptor -> listOf(PROPERTY_GETTER)
is FunctionDescriptor -> listOf(FUNCTION)
else -> listOf(FILE)
is PropertySetterDescriptor -> KotlinTarget.PROPERTY_SETTER_LIST
is PropertyGetterDescriptor -> KotlinTarget.PROPERTY_GETTER_LIST
is FunctionDescriptor -> KotlinTarget.FUNCTION_LIST
else -> KotlinTarget.FILE_LIST
}
val deprecatedParents = deprecatedParentTargetMap[modifierType]
if (deprecatedParents != null && actualParents.any { it in deprecatedParents }) {