Remove special case of generation for numeric and toPrimitiveArrays.
This commit is contained in:
@@ -20,26 +20,9 @@ fun generateCollectionsAPI(outDir: File) {
|
||||
sequences().writeTo(File(outDir, "_Sequences.kt")) { build() }
|
||||
specialJVM().writeTo(File(outDir, "_SpecialJVM.kt")) { build() }
|
||||
ranges().writeTo(File(outDir, "_Ranges.kt")) { build() }
|
||||
|
||||
toPrimitiveArrays().writeTo(File(outDir, "_ArraysToPrimitiveArrays.kt")) {
|
||||
val builder = StringBuilder()
|
||||
for (family in buildFamilies)
|
||||
build(builder, family, buildPrimitives.single())
|
||||
|
||||
builder.toString()
|
||||
}
|
||||
|
||||
numeric().writeTo(File(outDir, "_Numeric.kt")) {
|
||||
val builder = StringBuilder()
|
||||
for (numeric in numericPrimitives)
|
||||
for (family in buildFamilies)
|
||||
build(builder, family, numeric)
|
||||
|
||||
builder.toString()
|
||||
}
|
||||
|
||||
toPrimitiveArrays().writeTo(File(outDir, "_ArraysToPrimitiveArrays.kt")) { build() }
|
||||
numeric().writeTo(File(outDir, "_Numeric.kt")) { build() }
|
||||
comparables().writeTo(File(outDir, "_Comparables.kt")) { build() }
|
||||
|
||||
}
|
||||
|
||||
fun generateCollectionsJsAPI(outDir: File) {
|
||||
|
||||
@@ -64,7 +64,7 @@ fun toPrimitiveArrays(): List<GenericFunction> =
|
||||
val arrayType = primitive.name + "Array"
|
||||
f("to$arrayType()") {
|
||||
only(ArraysOfObjects, Collections)
|
||||
only(primitive)
|
||||
buildFamilies.forEach { family -> onlyPrimitives(family, primitive) }
|
||||
doc(ArraysOfObjects) { "Returns an array of ${primitive.name} containing all of the elements of this generic array." }
|
||||
doc(Collections) { "Returns an array of ${primitive.name} containing all of the elements of this collection." }
|
||||
returns(arrayType)
|
||||
|
||||
@@ -7,6 +7,7 @@ fun numeric(): List<GenericFunction> {
|
||||
|
||||
templates add f("sum()") {
|
||||
exclude(Strings)
|
||||
buildFamilies.forEach { family -> onlyPrimitives(family, numericPrimitives) }
|
||||
doc { "Returns the sum of all elements in the collection." }
|
||||
returns("SUM")
|
||||
platformName("sumOf<T>")
|
||||
@@ -24,6 +25,7 @@ fun numeric(): List<GenericFunction> {
|
||||
|
||||
templates add f("average()") {
|
||||
exclude(Strings)
|
||||
buildFamilies.forEach { family -> onlyPrimitives(family, numericPrimitives) }
|
||||
doc { "Returns an average value of elements in the collection."}
|
||||
returns("Double")
|
||||
platformName("averageOf<T>")
|
||||
|
||||
Reference in New Issue
Block a user