Replace deprecated toMap usages with toMapBy
This commit is contained in:
@@ -161,7 +161,7 @@ public enum class CharCategory(public val value: Int, public val code: String) {
|
||||
|
||||
|
||||
public companion object {
|
||||
private val categoryMap by lazy { CharCategory.values().toMap { it.value } }
|
||||
private val categoryMap by lazy { CharCategory.values().toMapBy { it.value } }
|
||||
|
||||
public fun valueOf(category: Int): CharCategory = categoryMap[category] ?: throw IllegalArgumentException("Category #$category is not defined.")
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public enum class CharDirectionality(public val value: Int) {
|
||||
|
||||
|
||||
public companion object {
|
||||
private val directionalityMap by lazy { CharDirectionality.values().toMap { it.value } }
|
||||
private val directionalityMap by lazy { CharDirectionality.values().toMapBy { it.value } }
|
||||
|
||||
public fun valueOf(directionality: Int): CharDirectionality = directionalityMap[directionality] ?: throw IllegalArgumentException("Directionality #$directionality is not defined.")
|
||||
}
|
||||
|
||||
@@ -170,11 +170,11 @@ fun mapDefinitions(repository: Repository, definitions: Iterable<InterfaceDefini
|
||||
definitions.filter { "NoInterfaceObject" !in it.extendedAttributes.map { it.call } }.map { generateTrait(repository, it) }
|
||||
|
||||
fun generateUnions(ifaces: List<GenerateTraitOrClass>, typedefs: Iterable<TypedefDefinition>): GenerateUnionTypes {
|
||||
val declaredTypes = ifaces.toMap { it.name }
|
||||
val declaredTypes = ifaces.toMapBy { it.name }
|
||||
|
||||
val anonymousUnionTypes = collectUnionTypes(declaredTypes)
|
||||
val anonymousUnionTypeTraits = generateUnionTypeTraits(anonymousUnionTypes)
|
||||
val anonymousUnionsMap = anonymousUnionTypeTraits.toMap { it.name }
|
||||
val anonymousUnionsMap = anonymousUnionTypeTraits.toMapBy { it.name }
|
||||
|
||||
val typedefsToBeGenerated = typedefs.filter { it.types is UnionType }
|
||||
.map { NamedValue(it.name, it.types as UnionType) }
|
||||
|
||||
@@ -227,7 +227,7 @@ private fun Pair<String, String>.betterName() = if (((0..9).map { it.toString()
|
||||
fun <K, V> List<Pair<K, V>>.toMultiMap(): Map<K, List<V>> = groupBy { it.first }.mapValues { it.value.map { it.second } }
|
||||
|
||||
fun Appendable.render(namespace: String, ifaces: List<GenerateTraitOrClass>, unions : GenerateUnionTypes) {
|
||||
val declaredTypes = ifaces.toMap { it.name }
|
||||
val declaredTypes = ifaces.toMapBy { it.name }
|
||||
|
||||
val allTypes = declaredTypes + unions.anonymousUnionsMap + unions.typedefsMarkersMap
|
||||
declaredTypes.values.filter { it.namespace == namespace }.forEach {
|
||||
|
||||
Reference in New Issue
Block a user