[JS IR] Fix arrayOfNulls API
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
package kotlin
|
package kotlin
|
||||||
|
|
||||||
import kotlin.internal.PureReifiable
|
import kotlin.internal.PureReifiable
|
||||||
|
import kotlin.js.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string representation of the object. Can be called with a null receiver, in which case
|
* Returns a string representation of the object. Can be called with a null receiver, in which case
|
||||||
@@ -24,7 +25,7 @@ public operator fun String?.plus(other: Any?): String =
|
|||||||
/**
|
/**
|
||||||
* Returns an array of objects of the given type with the given [size], initialized with null values.
|
* Returns an array of objects of the given type with the given [size], initialized with null values.
|
||||||
*/
|
*/
|
||||||
public inline fun <reified T> arrayOfNulls(size: Int): Array<T?> = Array<T?>(size)
|
public inline fun <reified T> arrayOfNulls(size: Int): Array<T?> = fillArrayVal<T?>(Array<T?>(size), null)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array containing the specified elements.
|
* Returns an array containing the specified elements.
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import withType
|
|||||||
|
|
||||||
external fun <T> Array(size: Int): Array<T>
|
external fun <T> Array(size: Int): Array<T>
|
||||||
|
|
||||||
|
@PublishedApi
|
||||||
internal fun <T> fillArrayVal(array: Array<T>, initValue: T): Array<T> {
|
internal fun <T> fillArrayVal(array: Array<T>, initValue: T): Array<T> {
|
||||||
for (i in 0..array.size - 1) {
|
for (i in 0..array.size - 1) {
|
||||||
array[i] = initValue
|
array[i] = initValue
|
||||||
|
|||||||
Reference in New Issue
Block a user