Minor, use stdlib instead of ifEmpty

This commit is contained in:
Alexander Udalov
2018-03-01 18:49:36 +01:00
parent a5a69c5099
commit 5ed5ac8291
@@ -17,10 +17,9 @@
package org.jetbrains.kotlin.serialization.deserialization package org.jetbrains.kotlin.serialization.deserialization
import org.jetbrains.kotlin.metadata.ProtoBuf import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.utils.ifEmpty
fun ProtoBuf.Class.supertypes(typeTable: TypeTable): List<ProtoBuf.Type> { fun ProtoBuf.Class.supertypes(typeTable: TypeTable): List<ProtoBuf.Type> {
return supertypeList.ifEmpty { supertypeIdList.map { typeTable[it] } } return supertypeList.takeIf(Collection<*>::isNotEmpty) ?: supertypeIdList.map { typeTable[it] }
} }
fun ProtoBuf.Type.Argument.type(typeTable: TypeTable): ProtoBuf.Type? { fun ProtoBuf.Type.Argument.type(typeTable: TypeTable): ProtoBuf.Type? {
@@ -40,7 +39,7 @@ fun ProtoBuf.Type.flexibleUpperBound(typeTable: TypeTable): ProtoBuf.Type? {
} }
fun ProtoBuf.TypeParameter.upperBounds(typeTable: TypeTable): List<ProtoBuf.Type> { fun ProtoBuf.TypeParameter.upperBounds(typeTable: TypeTable): List<ProtoBuf.Type> {
return upperBoundList.ifEmpty { upperBoundIdList.map { typeTable[it] } } return upperBoundList.takeIf(Collection<*>::isNotEmpty) ?: upperBoundIdList.map { typeTable[it] }
} }
fun ProtoBuf.Function.returnType(typeTable: TypeTable): ProtoBuf.Type { fun ProtoBuf.Function.returnType(typeTable: TypeTable): ProtoBuf.Type {