[FE 1.0] Remove usages of safeAs and cast from most of FE 1.0 modules:
- :core:descriptors - :core:descriptors.jvm - :core:deserialization - :compiler:cli - :compiler:frontend - :compiler:frontend:cfg - :compiler:frontend.java - :compiler:frontend.common.jvm - :compiler:psi - :compiler:resolution - :compiler:resolution.common - :compiler:resolution.common.jvm - :kotlin-reflect-api
This commit is contained in:
committed by
Space Team
parent
6afceb1e84
commit
d423782fac
+3
-8
@@ -20,18 +20,13 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaPackageFragment
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
fun CallableDescriptor.getContainingKotlinJvmBinaryClass(): KotlinJvmBinaryClass? {
|
||||
if (this !is DeserializedCallableMemberDescriptor) return null
|
||||
|
||||
val container = containingDeclaration
|
||||
|
||||
return when (container) {
|
||||
is DeserializedClassDescriptor ->
|
||||
container.source.safeAs<KotlinJvmBinarySourceElement>()?.binaryClass
|
||||
is LazyJavaPackageFragment ->
|
||||
container.source.safeAs<KotlinJvmBinaryPackageSourceElement>()?.getRepresentativeBinaryClass()
|
||||
return when (val container = containingDeclaration) {
|
||||
is DeserializedClassDescriptor -> (container.source as? KotlinJvmBinarySourceElement)?.binaryClass
|
||||
is LazyJavaPackageFragment -> (container.source as? KotlinJvmBinaryPackageSourceElement)?.getRepresentativeBinaryClass()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ object RuntimeAssertionsOnExtensionReceiverCallChecker : CallChecker {
|
||||
|
||||
private fun checkReceiver(receiverParameter: ReceiverParameterDescriptor?, receiverValue: ReceiverValue?, context: CallCheckerContext) {
|
||||
if (receiverParameter == null || receiverValue == null) return
|
||||
val expressionReceiverValue = receiverValue.safeAs<ExpressionReceiver>() ?: return
|
||||
val expressionReceiverValue = receiverValue as? ExpressionReceiver ?: return
|
||||
val receiverExpression = expressionReceiverValue.expression
|
||||
val c = context.resolutionContext
|
||||
|
||||
|
||||
Reference in New Issue
Block a user