translator: fix zero initializer for arrays

This commit is contained in:
Alexey Stepanov
2016-08-16 13:13:47 +03:00
parent 07b4b87984
commit 3358a9caaa
5 changed files with 25 additions and 0 deletions
+5
View File
@@ -8,6 +8,11 @@ class BooleanArray(var size: Int) {
init {
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. */
+5
View File
@@ -12,6 +12,11 @@ class ByteArray(var size: Int) {
init {
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. */
+5
View File
@@ -11,6 +11,11 @@ class IntArray(var size: Int) {
init {
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. */
+5
View File
@@ -11,6 +11,11 @@ class LongArray(var size: Int) {
init {
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. */
+5
View File
@@ -11,6 +11,11 @@ class ShortArray(var size: Int) {
init {
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. */