translator: fix zero initializer for arrays
This commit is contained in:
@@ -8,6 +8,11 @@ class BooleanArray(var size: Int) {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
this.data = malloc_array(kotlinclib_boolean_size() * this.size)
|
this.data = malloc_array(kotlinclib_boolean_size() * this.size)
|
||||||
|
var index = 0
|
||||||
|
while (index < this.size) {
|
||||||
|
set(index, false)
|
||||||
|
index = index + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ class ByteArray(var size: Int) {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
this.data = malloc_array(kotlinclib_byte_size() * this.size)
|
this.data = malloc_array(kotlinclib_byte_size() * this.size)
|
||||||
|
var index = 0
|
||||||
|
while (index < this.size) {
|
||||||
|
set(index, 0)
|
||||||
|
index = index + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ class IntArray(var size: Int) {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
this.data = malloc_array(kotlinclib_int_size() * this.size)
|
this.data = malloc_array(kotlinclib_int_size() * this.size)
|
||||||
|
var index = 0
|
||||||
|
while (index < this.size) {
|
||||||
|
set(index, 0)
|
||||||
|
index = index + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ class LongArray(var size: Int) {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
this.data = malloc_array(kotlinclib_long_size() * this.size)
|
this.data = malloc_array(kotlinclib_long_size() * this.size)
|
||||||
|
var index = 0
|
||||||
|
while (index < this.size) {
|
||||||
|
set(index, 0)
|
||||||
|
index = index + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ class ShortArray(var size: Int) {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
this.data = malloc_array(kotlinclib_short_size() * this.size)
|
this.data = malloc_array(kotlinclib_short_size() * this.size)
|
||||||
|
var index = 0
|
||||||
|
while (index < this.size) {
|
||||||
|
set(index, 0)
|
||||||
|
index = index + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||||
|
|||||||
Reference in New Issue
Block a user