Add code generation for asList methods in js.libraries.
This commit is contained in:
committed by
Ilya Gorbunov
parent
abdac27b61
commit
d724ce3f7e
@@ -0,0 +1,76 @@
|
||||
package kotlin
|
||||
|
||||
//
|
||||
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
|
||||
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
|
||||
//
|
||||
|
||||
import java.util.*
|
||||
|
||||
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
|
||||
|
||||
/**
|
||||
* Returns a list that wraps the original array
|
||||
*/
|
||||
public fun <T> Array<out T>.asList(): List<T> {
|
||||
val al = ArrayList<T>()
|
||||
(al: dynamic).array = this // black dynamic magic
|
||||
return al
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list that wraps the original array
|
||||
*/
|
||||
public inline fun BooleanArray.asList(): List<Boolean> {
|
||||
return (this as Array<Boolean>).asList()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list that wraps the original array
|
||||
*/
|
||||
public inline fun ByteArray.asList(): List<Byte> {
|
||||
return (this as Array<Byte>).asList()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list that wraps the original array
|
||||
*/
|
||||
public inline fun CharArray.asList(): List<Char> {
|
||||
return (this as Array<Char>).asList()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list that wraps the original array
|
||||
*/
|
||||
public inline fun DoubleArray.asList(): List<Double> {
|
||||
return (this as Array<Double>).asList()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list that wraps the original array
|
||||
*/
|
||||
public inline fun FloatArray.asList(): List<Float> {
|
||||
return (this as Array<Float>).asList()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list that wraps the original array
|
||||
*/
|
||||
public inline fun IntArray.asList(): List<Int> {
|
||||
return (this as Array<Int>).asList()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list that wraps the original array
|
||||
*/
|
||||
public inline fun LongArray.asList(): List<Long> {
|
||||
return (this as Array<Long>).asList()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list that wraps the original array
|
||||
*/
|
||||
public inline fun ShortArray.asList(): List<Short> {
|
||||
return (this as Array<Short>).asList()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user