Document Array and String get() function behavior (KT-30141)
This commit is contained in:
@@ -43,9 +43,20 @@ class GenerateArrays(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
out.println(" */")
|
||||
out.println(" public inline constructor(size: Int, init: (Int) -> $s)")
|
||||
out.println()
|
||||
out.println(" /** Returns the array element at the given [index]. This method can be called using the index operator. */")
|
||||
out.println(" /**")
|
||||
out.println(" * Returns the array element at the given [index]. This method can be called using the index operator.")
|
||||
out.println(" *")
|
||||
out.println(" * If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS")
|
||||
out.println(" * where the behavior is unspecified.")
|
||||
out.println(" */")
|
||||
out.println(" public operator fun get(index: Int): $s")
|
||||
out.println(" /** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */")
|
||||
out.println()
|
||||
out.println(" /**")
|
||||
out.println(" * Sets the element at the given [index] to the given [value]. This method can be called using the index operator.")
|
||||
out.println(" *")
|
||||
out.println(" * If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS")
|
||||
out.println(" * where the behavior is unspecified.")
|
||||
out.println(" */")
|
||||
out.println(" public operator fun set(index: Int, value: $s): Unit")
|
||||
out.println()
|
||||
out.println(" /** Returns the number of elements in the array. */")
|
||||
|
||||
@@ -428,10 +428,20 @@ class UnsignedArrayGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIn
|
||||
/** Creates a new array of the specified [size], with all elements initialized to zero. */
|
||||
public constructor(size: Int) : this($storageArrayType(size))
|
||||
|
||||
/** 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.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): $elementType = storage[index].to$elementType()
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: $elementType) {
|
||||
storage[index] = value.to$storageElementType()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user