stdlib-gen, minor: rename property
This commit is contained in:
@@ -749,7 +749,7 @@ object Filtering : TemplateGroupBase() {
|
|||||||
typeParam("reified R")
|
typeParam("reified R")
|
||||||
typeParam("C : MutableCollection<in R>")
|
typeParam("C : MutableCollection<in R>")
|
||||||
inline()
|
inline()
|
||||||
receiverAsterisk = true
|
genericStarProjection = true
|
||||||
returns("C")
|
returns("C")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
@@ -766,7 +766,7 @@ object Filtering : TemplateGroupBase() {
|
|||||||
typeParam("reified R")
|
typeParam("reified R")
|
||||||
returns("List<@kotlin.internal.NoInfer R>")
|
returns("List<@kotlin.internal.NoInfer R>")
|
||||||
inline()
|
inline()
|
||||||
receiverAsterisk = true
|
genericStarProjection = true
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
return filterIsInstanceTo(ArrayList<R>())
|
return filterIsInstanceTo(ArrayList<R>())
|
||||||
@@ -790,7 +790,7 @@ object Filtering : TemplateGroupBase() {
|
|||||||
include(Iterables, ArraysOfObjects, Sequences)
|
include(Iterables, ArraysOfObjects, Sequences)
|
||||||
} builder {
|
} builder {
|
||||||
doc { "Appends all elements that are instances of specified class to the given [destination]." }
|
doc { "Appends all elements that are instances of specified class to the given [destination]." }
|
||||||
receiverAsterisk = true
|
genericStarProjection = true
|
||||||
typeParam("C : MutableCollection<in R>")
|
typeParam("C : MutableCollection<in R>")
|
||||||
typeParam("R")
|
typeParam("R")
|
||||||
returns("C")
|
returns("C")
|
||||||
@@ -808,7 +808,7 @@ object Filtering : TemplateGroupBase() {
|
|||||||
include(Iterables, ArraysOfObjects, Sequences)
|
include(Iterables, ArraysOfObjects, Sequences)
|
||||||
} builder {
|
} builder {
|
||||||
doc { "Returns a list containing all elements that are instances of specified class." }
|
doc { "Returns a list containing all elements that are instances of specified class." }
|
||||||
receiverAsterisk= true
|
genericStarProjection = true
|
||||||
typeParam("R")
|
typeParam("R")
|
||||||
returns("List<R>")
|
returns("List<R>")
|
||||||
body {
|
body {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ object Numeric : TemplateGroupBase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: use just numericPrimitives
|
|
||||||
private val numericPrimitivesDefaultOrder = PrimitiveType.defaultPrimitives intersect PrimitiveType.numericPrimitives
|
private val numericPrimitivesDefaultOrder = PrimitiveType.defaultPrimitives intersect PrimitiveType.numericPrimitives
|
||||||
|
|
||||||
val f_sum = fn("sum()") {
|
val f_sum = fn("sum()") {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class MemberBuilder(
|
|||||||
val typeParams = mutableListOf<String>()
|
val typeParams = mutableListOf<String>()
|
||||||
var primaryTypeParameter: String? = null; private set
|
var primaryTypeParameter: String? = null; private set
|
||||||
var customReceiver: String? = null; private set
|
var customReceiver: String? = null; private set
|
||||||
var receiverAsterisk: Boolean = false // TODO: rename to genericStarProjection
|
var genericStarProjection: Boolean = false
|
||||||
var toNullableT: Boolean = false
|
var toNullableT: Boolean = false
|
||||||
|
|
||||||
var returns: String? = null; private set
|
var returns: String? = null; private set
|
||||||
@@ -246,19 +246,19 @@ class MemberBuilder(
|
|||||||
return answer.toString()
|
return answer.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
val isAsteriskOrT = if (receiverAsterisk) "*" else primaryTypeParameter
|
val receiverT = if (genericStarProjection) "*" else primaryTypeParameter
|
||||||
val self = (when (family) {
|
val self = (when (family) {
|
||||||
Iterables -> "Iterable<$isAsteriskOrT>"
|
Iterables -> "Iterable<$receiverT>"
|
||||||
Collections -> "Collection<$isAsteriskOrT>"
|
Collections -> "Collection<$receiverT>"
|
||||||
Lists -> "List<$isAsteriskOrT>"
|
Lists -> "List<$receiverT>"
|
||||||
Maps -> "Map<out K, V>"
|
Maps -> "Map<out K, V>"
|
||||||
Sets -> "Set<$isAsteriskOrT>"
|
Sets -> "Set<$receiverT>"
|
||||||
Sequences -> "Sequence<$isAsteriskOrT>"
|
Sequences -> "Sequence<$receiverT>"
|
||||||
InvariantArraysOfObjects -> "Array<$primaryTypeParameter>"
|
InvariantArraysOfObjects -> "Array<$primaryTypeParameter>"
|
||||||
ArraysOfObjects -> "Array<${isAsteriskOrT.replace(primaryTypeParameter, "out $primaryTypeParameter")}>"
|
ArraysOfObjects -> "Array<${receiverT.replace(primaryTypeParameter, "out $primaryTypeParameter")}>"
|
||||||
Strings -> "String"
|
Strings -> "String"
|
||||||
CharSequences -> "CharSequence"
|
CharSequences -> "CharSequence"
|
||||||
Ranges -> "ClosedRange<$isAsteriskOrT>"
|
Ranges -> "ClosedRange<$receiverT>"
|
||||||
ArraysOfPrimitives, ArraysOfUnsigned -> primitive?.let { it.name + "Array" } ?: throw IllegalArgumentException("Primitive array should specify primitive type")
|
ArraysOfPrimitives, ArraysOfUnsigned -> primitive?.let { it.name + "Array" } ?: throw IllegalArgumentException("Primitive array should specify primitive type")
|
||||||
RangesOfPrimitives -> primitive?.let { it.name + "Range" } ?: throw IllegalArgumentException("Primitive range should specify primitive type")
|
RangesOfPrimitives -> primitive?.let { it.name + "Range" } ?: throw IllegalArgumentException("Primitive range should specify primitive type")
|
||||||
ProgressionsOfPrimitives -> primitive?.let { it.name + "Progression" } ?: throw IllegalArgumentException("Primitive progression should specify primitive type")
|
ProgressionsOfPrimitives -> primitive?.let { it.name + "Progression" } ?: throw IllegalArgumentException("Primitive progression should specify primitive type")
|
||||||
|
|||||||
Reference in New Issue
Block a user