JVM_IR: Handle annotation KClass fields in external declarations

This commit is contained in:
Steven Schäfer
2019-06-25 11:05:25 +02:00
committed by Alexander Udalov
parent 1ab0b76af3
commit e7a5e5b4a0
10 changed files with 41 additions and 146 deletions
@@ -36,6 +36,13 @@ fun IrType.isKotlinResult(): Boolean = isNameInPackage("Result", kotlinPackageFq
fun IrType.isContinuation(): Boolean = isNameInPackage("Continuation", kotlinCoroutinesPackageFqn)
fun IrType.isNullableContinuation(): Boolean = isContinuation() && this is IrSimpleType && hasQuestionMark
fun IrType.isKClassArray(): Boolean {
if (!isNonPrimitiveArray()) return false
val argument = (this as? IrSimpleType)?.arguments?.singleOrNull() ?: return false
val argumentType = (argument as? IrTypeProjection)?.type ?: return false
return argumentType.isKClass()
}
fun IrType.isNameInPackage(prefix: String, packageFqName: FqName): Boolean {
val classifier = classifierOrNull ?: return false
val name = classifier.descriptor.name.asString()