Extract some cone type utils properties to reuse them in visualizer

This commit is contained in:
Ivan Kylchik
2021-03-04 15:01:04 +03:00
committed by TeamCityServer
parent bbf5c4412e
commit 13d8b10be0
2 changed files with 13 additions and 9 deletions
@@ -977,14 +977,6 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
print("|") print("|")
} }
private val FirResolvedTypeRef.functionTypeKind: FunctionClassKind?
get() {
val classId = (type as? ConeClassLikeType)?.lookupTag?.classId ?: return null
return FunctionClassKind.getFunctionalClassKind(
classId.shortClassName.asString(), classId.packageFqName
)
}
override fun visitUserTypeRef(userTypeRef: FirUserTypeRef) { override fun visitUserTypeRef(userTypeRef: FirUserTypeRef) {
userTypeRef.annotations.renderAnnotations() userTypeRef.annotations.renderAnnotations()
if (userTypeRef.customRenderer) { if (userTypeRef.customRenderer) {
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.fir.types package org.jetbrains.kotlin.fir.types
import org.jetbrains.kotlin.builtins.functions.FunctionClassKind
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.render
import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.fir.symbols.StandardClassIds
@@ -168,4 +169,15 @@ val ConeKotlinType.canBeNull: Boolean
is ConeIntersectionType -> intersectedTypes.any { it.canBeNull } is ConeIntersectionType -> intersectedTypes.any { it.canBeNull }
else -> isNullable else -> isNullable
} }
} }
val ConeKotlinType?.functionTypeKind: FunctionClassKind?
get() {
val classId = (this as? ConeClassLikeType)?.lookupTag?.classId ?: return null
return FunctionClassKind.getFunctionalClassKind(
classId.shortClassName.asString(), classId.packageFqName
)
}
val FirResolvedTypeRef.functionTypeKind: FunctionClassKind?
get() = type.functionTypeKind