Move util functions from KotlinBuiltIns to :core:descriptors.common module

This commit is contained in:
Dmitriy Novozhilov
2020-08-16 23:42:40 +03:00
parent 20a2ad8223
commit 45cf221b97
12 changed files with 65 additions and 56 deletions
@@ -232,7 +232,7 @@ private fun PropertyDescriptor.formatReadFromParcel(parcelName: String): String?
fun KotlinType.formatJavaClassloader() = "${this.constructor.declarationDescriptor?.fqNameSafe}::class.java.classLoader"
// There is no read/write short array methods
if (KotlinBuiltIns.isPrimitiveArray(type) && KotlinBuiltIns.getPrimitiveArrayElementType(type) != PrimitiveType.SHORT) {
if (KotlinBuiltInsNames.isPrimitiveArray(type) && KotlinBuiltIns.getPrimitiveArrayElementType(type) != PrimitiveType.SHORT) {
return "$parcelName.create${type.getName()}()"
}
@@ -271,7 +271,7 @@ private fun PropertyDescriptor.formatWriteToParcel(parcelName: String, flagsName
val type = returnType ?: return null
// There is no read/write short array methods
if (KotlinBuiltIns.isPrimitiveArray(type) && KotlinBuiltIns.getPrimitiveArrayElementType(type) != PrimitiveType.SHORT) {
if (KotlinBuiltInsNames.isPrimitiveArray(type) && KotlinBuiltIns.getPrimitiveArrayElementType(type) != PrimitiveType.SHORT) {
return "$parcelName.write${type.getName()}($name)"
}
@@ -450,4 +450,4 @@ private fun KotlinType.isSparseBooleanArray(): Boolean = fqNameEquals("android.u
private fun KotlinType.isBundle(): Boolean = fqNameEquals("android.os.Bundle")
private fun <T : KtDeclaration> T.addNewLineBeforeDeclaration() = parent.addBefore(KtPsiFactory(this).createNewLine(), this)
private fun <T : KtDeclaration> T.addNewLineBeforeDeclaration() = parent.addBefore(KtPsiFactory(this).createNewLine(), this)