translator: add support square brackets to standart arrays
This commit is contained in:
@@ -9,14 +9,14 @@ class BooleanArray(var size: Int) {
|
||||
}
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
fun get(index: Int): Boolean {
|
||||
operator fun get(index: Int): Boolean {
|
||||
val res = kotlinclib_get_byte(this.data, index) == 1.toByte()
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
fun set(index: Int, value: Boolean) {
|
||||
operator fun set(index: Int, value: Boolean) {
|
||||
if (value == true) {
|
||||
kotlinclib_set_byte(this.data, index, 1.toByte())
|
||||
}
|
||||
@@ -39,4 +39,3 @@ class BooleanArray(var size: Int) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@ class ByteArray(var size: Int) {
|
||||
}
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
fun get(index: Int): Byte {
|
||||
operator fun get(index: Int): Byte {
|
||||
return kotlinclib_get_byte(this.data, index)
|
||||
}
|
||||
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
fun set(index: Int, value: Byte) {
|
||||
operator fun set(index: Int, value: Byte) {
|
||||
kotlinclib_set_byte(this.data, index, value)
|
||||
}
|
||||
|
||||
@@ -38,4 +38,3 @@ class ByteArray(var size: Int) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ class IntArray(var size: Int) {
|
||||
}
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
fun get(index: Int): Int {
|
||||
operator fun get(index: Int): Int {
|
||||
return kotlinclib_get_int(this.data, index)
|
||||
}
|
||||
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
fun set(index: Int, value: Int) {
|
||||
operator fun set(index: Int, value: Int) {
|
||||
kotlinclib_set_int(this.data, index, value)
|
||||
}
|
||||
|
||||
@@ -37,4 +37,3 @@ class IntArray(var size: Int) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ class ShortArray(var size: Int) {
|
||||
}
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
fun get(index: Int): Short {
|
||||
operator fun get(index: Int): Short {
|
||||
return kotlinclib_get_short(this.data, index)
|
||||
}
|
||||
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
fun set(index: Int, value: Short) {
|
||||
operator fun set(index: Int, value: Short) {
|
||||
kotlinclib_set_short(this.data, index, value)
|
||||
}
|
||||
|
||||
@@ -37,4 +37,3 @@ class ShortArray(var size: Int) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user