Minor, use stdlib instead of ifEmpty
This commit is contained in:
+3
-4
@@ -17,10 +17,9 @@
|
||||
package org.jetbrains.kotlin.serialization.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.utils.ifEmpty
|
||||
|
||||
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? {
|
||||
@@ -40,7 +39,7 @@ fun ProtoBuf.Type.flexibleUpperBound(typeTable: TypeTable): 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 {
|
||||
@@ -102,4 +101,4 @@ fun ProtoBuf.TypeAlias.underlyingType(typeTable: TypeTable): ProtoBuf.Type =
|
||||
if (hasUnderlyingTypeId()) typeTable[underlyingTypeId] else underlyingType
|
||||
|
||||
fun ProtoBuf.TypeAlias.expandedType(typeTable: TypeTable): ProtoBuf.Type =
|
||||
if (hasExpandedTypeId()) typeTable[expandedTypeId] else expandedType
|
||||
if (hasExpandedTypeId()) typeTable[expandedTypeId] else expandedType
|
||||
|
||||
Reference in New Issue
Block a user