[JS IR] Fix arrayOfNulls API

This commit is contained in:
Roman Artemev
2019-11-14 18:11:23 +03:00
committed by romanart
parent f2093a1763
commit 18d0b477b6
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -6,6 +6,7 @@
package kotlin
import kotlin.internal.PureReifiable
import kotlin.js.*
/**
* 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.
*/
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.
+1
View File
@@ -9,6 +9,7 @@ import withType
external fun <T> Array(size: Int): Array<T>
@PublishedApi
internal fun <T> fillArrayVal(array: Array<T>, initValue: T): Array<T> {
for (i in 0..array.size - 1) {
array[i] = initValue