[light classes] ultraLightUtils: cleanup code
^KT-53097
This commit is contained in:
@@ -143,14 +143,15 @@ private fun <D, T> buildTypeParameterList(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal fun KtDeclaration.getKotlinType(): KotlinType? {
|
internal fun KtDeclaration.getKotlinType(): KotlinType? = when (val descriptor = resolve()) {
|
||||||
val descriptor = resolve()
|
is ValueDescriptor -> descriptor.type
|
||||||
return when (descriptor) {
|
is CallableDescriptor ->
|
||||||
is ValueDescriptor -> descriptor.type
|
if (descriptor is FunctionDescriptor && descriptor.isSuspend)
|
||||||
is CallableDescriptor -> if (descriptor is FunctionDescriptor && descriptor.isSuspend)
|
descriptor.module.builtIns.nullableAnyType
|
||||||
descriptor.module.builtIns.nullableAnyType else descriptor.returnType
|
else
|
||||||
else -> null
|
descriptor.returnType
|
||||||
}
|
|
||||||
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun KtDeclaration.resolve() = LightClassGenerationSupport.getInstance(project).resolveToDescriptor(this)
|
internal fun KtDeclaration.resolve() = LightClassGenerationSupport.getInstance(project).resolveToDescriptor(this)
|
||||||
@@ -392,11 +393,12 @@ internal fun KtModifierListOwner.isHiddenByDeprecation(support: KtUltraLightSupp
|
|||||||
val annotations = annotationEntries.filter { annotation ->
|
val annotations = annotationEntries.filter { annotation ->
|
||||||
annotation.looksLikeDeprecated()
|
annotation.looksLikeDeprecated()
|
||||||
}
|
}
|
||||||
if (annotations.isNotEmpty()) { // some candidates found
|
|
||||||
|
return if (annotations.isNotEmpty()) { // some candidates found
|
||||||
val deprecated = support.findAnnotation(this, StandardNames.FqNames.deprecated)?.second
|
val deprecated = support.findAnnotation(this, StandardNames.FqNames.deprecated)?.second
|
||||||
return (deprecated?.argumentValue("level") as? EnumValue)?.enumEntryName?.asString() == "HIDDEN"
|
(deprecated?.argumentValue("level") as? EnumValue)?.enumEntryName?.asString() == "HIDDEN"
|
||||||
} else {
|
} else {
|
||||||
return false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,6 +508,7 @@ private fun ConstantValue<*>.asStringForPsiLiteral(parent: PsiElement): String =
|
|||||||
|
|
||||||
"$canonicalText$arrayPart.class"
|
"$canonicalText$arrayPart.class"
|
||||||
}
|
}
|
||||||
|
|
||||||
is EnumValue -> "${enumClassId.asSingleFqName().asString()}.$enumEntryName"
|
is EnumValue -> "${enumClassId.asSingleFqName().asString()}.$enumEntryName"
|
||||||
else -> when (value) {
|
else -> when (value) {
|
||||||
is Long -> "${value}L"
|
is Long -> "${value}L"
|
||||||
|
|||||||
Reference in New Issue
Block a user