Array.copyOfRange: rename from, to to fromIndex, toIndex
This commit is contained in:
@@ -214,72 +214,72 @@ public fun <T> Array<out T>.copyOf(newSize: Int): Array<T?> {
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
suppress("NOTHING_TO_INLINE")
|
||||
public inline fun <T> Array<out T>.copyOfRange(from: Int, to: Int): Array<T> {
|
||||
return (this: dynamic).slice(from, to)
|
||||
public inline fun <T> Array<out T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T> {
|
||||
return (this: dynamic).slice(fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
suppress("NOTHING_TO_INLINE")
|
||||
public inline fun BooleanArray.copyOfRange(from: Int, to: Int): BooleanArray {
|
||||
return (this: dynamic).slice(from, to)
|
||||
public inline fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): BooleanArray {
|
||||
return (this: dynamic).slice(fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
suppress("NOTHING_TO_INLINE")
|
||||
public inline fun ByteArray.copyOfRange(from: Int, to: Int): ByteArray {
|
||||
return (this: dynamic).slice(from, to)
|
||||
public inline fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray {
|
||||
return (this: dynamic).slice(fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
suppress("NOTHING_TO_INLINE")
|
||||
public inline fun CharArray.copyOfRange(from: Int, to: Int): CharArray {
|
||||
return (this: dynamic).slice(from, to)
|
||||
public inline fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray {
|
||||
return (this: dynamic).slice(fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
suppress("NOTHING_TO_INLINE")
|
||||
public inline fun DoubleArray.copyOfRange(from: Int, to: Int): DoubleArray {
|
||||
return (this: dynamic).slice(from, to)
|
||||
public inline fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray {
|
||||
return (this: dynamic).slice(fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
suppress("NOTHING_TO_INLINE")
|
||||
public inline fun FloatArray.copyOfRange(from: Int, to: Int): FloatArray {
|
||||
return (this: dynamic).slice(from, to)
|
||||
public inline fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArray {
|
||||
return (this: dynamic).slice(fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
suppress("NOTHING_TO_INLINE")
|
||||
public inline fun IntArray.copyOfRange(from: Int, to: Int): IntArray {
|
||||
return (this: dynamic).slice(from, to)
|
||||
public inline fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray {
|
||||
return (this: dynamic).slice(fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
suppress("NOTHING_TO_INLINE")
|
||||
public inline fun LongArray.copyOfRange(from: Int, to: Int): LongArray {
|
||||
return (this: dynamic).slice(from, to)
|
||||
public inline fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray {
|
||||
return (this: dynamic).slice(fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
suppress("NOTHING_TO_INLINE")
|
||||
public inline fun ShortArray.copyOfRange(from: Int, to: Int): ShortArray {
|
||||
return (this: dynamic).slice(from, to)
|
||||
public inline fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray {
|
||||
return (this: dynamic).slice(fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -345,72 +345,72 @@ public fun <T> Array<T>.copyOf(newSize: Int): Array<T?> {
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
public fun <T> Array<out T>.copyOfRange(from: Int, to: Int): Array<out T> {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
public fun <T> Array<out T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<out T> {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
public fun BooleanArray.copyOfRange(from: Int, to: Int): BooleanArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
public fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): BooleanArray {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
public fun ByteArray.copyOfRange(from: Int, to: Int): ByteArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
public fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
public fun CharArray.copyOfRange(from: Int, to: Int): CharArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
public fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
public fun DoubleArray.copyOfRange(from: Int, to: Int): DoubleArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
public fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
public fun FloatArray.copyOfRange(from: Int, to: Int): FloatArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
public fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArray {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
public fun IntArray.copyOfRange(from: Int, to: Int): IntArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
public fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
public fun LongArray.copyOfRange(from: Int, to: Int): LongArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
public fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
public fun ShortArray.copyOfRange(from: Int, to: Int): ShortArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
public fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
platformName("mutableCopyOfRange")
|
||||
public fun <T> Array<T>.copyOfRange(from: Int, to: Int): Array<T> {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
public fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T> {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,7 @@ fun specialJS(): List<GenericFunction> {
|
||||
}
|
||||
}
|
||||
|
||||
templates add f("copyOfRange(from: Int, to: Int)") {
|
||||
templates add f("copyOfRange(fromIndex: Int, toIndex: Int)") {
|
||||
// TODO: Arguments checking as in java?
|
||||
only(ArraysOfObjects, ArraysOfPrimitives)
|
||||
doc { "Returns new array which is a copy of range of original array." }
|
||||
@@ -46,7 +46,7 @@ fun specialJS(): List<GenericFunction> {
|
||||
returns("SELF")
|
||||
returns(ArraysOfObjects) { "Array<T>" }
|
||||
body {
|
||||
"return (this: dynamic).slice(from, to)"
|
||||
"return (this: dynamic).slice(fromIndex, toIndex)"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,13 +50,13 @@ fun specialJVM(): List<GenericFunction> {
|
||||
}
|
||||
|
||||
|
||||
templates add f("copyOfRange(from: Int, to: Int)") {
|
||||
templates add f("copyOfRange(fromIndex: Int, toIndex: Int)") {
|
||||
only(ArraysOfObjects, InvariantArraysOfObjects, ArraysOfPrimitives)
|
||||
doc { "Returns new array which is a copy of range of original array." }
|
||||
returns("SELF")
|
||||
annotations(InvariantArraysOfObjects) { """platformName("mutableCopyOfRange")"""}
|
||||
body {
|
||||
"return Arrays.copyOfRange(this, from, to)"
|
||||
"return Arrays.copyOfRange(this, fromIndex, toIndex)"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user