Generate additional sources for JS instead of copying them from JVM

This commit is contained in:
Ilya Gorbunov
2016-12-03 03:11:00 +03:00
parent bc2d7dda2c
commit 6ea1cde449
17 changed files with 19135 additions and 713 deletions
+301 -300
View File
@@ -1,5 +1,6 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("ArraysKt")
@file:kotlin.jvm.JvmVersion
package kotlin.collections
@@ -12599,6 +12600,306 @@ public fun CharArray.asSequence(): Sequence<Char> {
return Sequence { this.iterator() }
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfByte")
public fun Array<out Byte>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfShort")
public fun Array<out Short>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfInt")
public fun Array<out Int>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfLong")
public fun Array<out Long>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfFloat")
public fun Array<out Float>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfDouble")
public fun Array<out Double>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun ByteArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun ShortArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun IntArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun LongArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun FloatArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun DoubleArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfByte")
public fun Array<out Byte>.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfShort")
public fun Array<out Short>.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfInt")
public fun Array<out Int>.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfLong")
public fun Array<out Long>.sum(): Long {
var sum: Long = 0L
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfFloat")
public fun Array<out Float>.sum(): Float {
var sum: Float = 0.0f
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfDouble")
public fun Array<out Double>.sum(): Double {
var sum: Double = 0.0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun ByteArray.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun ShortArray.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun IntArray.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun LongArray.sum(): Long {
var sum: Long = 0L
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun FloatArray.sum(): Float {
var sum: Float = 0.0f
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun DoubleArray.sum(): Double {
var sum: Double = 0.0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns a [List] that wraps the original array.
*/
@@ -13759,303 +14060,3 @@ public fun CharArray.toTypedArray(): Array<Char> {
return result as Array<Char>
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfByte")
public fun Array<out Byte>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfShort")
public fun Array<out Short>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfInt")
public fun Array<out Int>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfLong")
public fun Array<out Long>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfFloat")
public fun Array<out Float>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
@kotlin.jvm.JvmName("averageOfDouble")
public fun Array<out Double>.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun ByteArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun ShortArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun IntArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun LongArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun FloatArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns an average value of elements in the array.
*/
public fun DoubleArray.average(): Double {
var sum: Double = 0.0
var count: Int = 0
for (element in this) {
sum += element
count += 1
}
return if (count == 0) 0.0 else sum / count
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfByte")
public fun Array<out Byte>.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfShort")
public fun Array<out Short>.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfInt")
public fun Array<out Int>.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfLong")
public fun Array<out Long>.sum(): Long {
var sum: Long = 0L
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfFloat")
public fun Array<out Float>.sum(): Float {
var sum: Float = 0.0f
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfDouble")
public fun Array<out Double>.sum(): Double {
var sum: Double = 0.0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun ByteArray.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun ShortArray.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun IntArray.sum(): Int {
var sum: Int = 0
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun LongArray.sum(): Long {
var sum: Long = 0L
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun FloatArray.sum(): Float {
var sum: Float = 0.0f
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the array.
*/
public fun DoubleArray.sum(): Double {
var sum: Double = 0.0
for (element in this) {
sum += element
}
return sum
}
+19 -18
View File
@@ -1,5 +1,6 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("CollectionsKt")
@file:kotlin.jvm.JvmVersion
package kotlin.collections
@@ -1959,24 +1960,6 @@ public fun <T> Iterable<T>.asSequence(): Sequence<T> {
return Sequence { this.iterator() }
}
/**
* Returns a list containing all elements that are instances of specified class.
*/
@kotlin.jvm.JvmVersion
public fun <R> Iterable<*>.filterIsInstance(klass: Class<R>): List<R> {
return filterIsInstanceTo(ArrayList<R>(), klass)
}
/**
* Appends all elements that are instances of specified class to the given [destination].
*/
@kotlin.jvm.JvmVersion
public fun <C : MutableCollection<in R>, R> Iterable<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C {
@Suppress("UNCHECKED_CAST")
for (element in this) if (klass.isInstance(element)) destination.add(element as R)
return destination
}
/**
* Returns an average value of elements in the collection.
*/
@@ -2133,3 +2116,21 @@ public fun Iterable<Double>.sum(): Double {
return sum
}
/**
* Returns a list containing all elements that are instances of specified class.
*/
@kotlin.jvm.JvmVersion
public fun <R> Iterable<*>.filterIsInstance(klass: Class<R>): List<R> {
return filterIsInstanceTo(ArrayList<R>(), klass)
}
/**
* Appends all elements that are instances of specified class to the given [destination].
*/
@kotlin.jvm.JvmVersion
public fun <C : MutableCollection<in R>, R> Iterable<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C {
@Suppress("UNCHECKED_CAST")
for (element in this) if (klass.isInstance(element)) destination.add(element as R)
return destination
}
+1
View File
@@ -1,5 +1,6 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("MapsKt")
@file:kotlin.jvm.JvmVersion
package kotlin.collections
@@ -1,5 +1,6 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("RangesKt")
@file:kotlin.jvm.JvmVersion
package kotlin.ranges
+20 -19
View File
@@ -1,5 +1,6 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("SequencesKt")
@file:kotlin.jvm.JvmVersion
package kotlin.sequences
@@ -1237,25 +1238,6 @@ public inline fun <T> Sequence<T>.asSequence(): Sequence<T> {
return this
}
/**
* Returns a sequence containing all elements that are instances of specified class.
*/
@kotlin.jvm.JvmVersion
public fun <R> Sequence<*>.filterIsInstance(klass: Class<R>): Sequence<R> {
@Suppress("UNCHECKED_CAST")
return filter { klass.isInstance(it) } as Sequence<R>
}
/**
* Appends all elements that are instances of specified class to the given [destination].
*/
@kotlin.jvm.JvmVersion
public fun <C : MutableCollection<in R>, R> Sequence<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C {
@Suppress("UNCHECKED_CAST")
for (element in this) if (klass.isInstance(element)) destination.add(element as R)
return destination
}
/**
* Returns an average value of elements in the sequence.
*/
@@ -1412,3 +1394,22 @@ public fun Sequence<Double>.sum(): Double {
return sum
}
/**
* Returns a sequence containing all elements that are instances of specified class.
*/
@kotlin.jvm.JvmVersion
public fun <R> Sequence<*>.filterIsInstance(klass: Class<R>): Sequence<R> {
@Suppress("UNCHECKED_CAST")
return filter { klass.isInstance(it) } as Sequence<R>
}
/**
* Appends all elements that are instances of specified class to the given [destination].
*/
@kotlin.jvm.JvmVersion
public fun <C : MutableCollection<in R>, R> Sequence<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C {
@Suppress("UNCHECKED_CAST")
for (element in this) if (klass.isInstance(element)) destination.add(element as R)
return destination
}
+1
View File
@@ -1,5 +1,6 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("SetsKt")
@file:kotlin.jvm.JvmVersion
package kotlin.collections
@@ -1,5 +1,6 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("StringsKt")
@file:kotlin.jvm.JvmVersion
package kotlin.text