[Wasm] Major compiler and stdlib update

This commit is contained in:
Svyatoslav Kuzmich
2020-04-27 14:39:20 +03:00
parent 3be38d1796
commit bfd0f21e9d
196 changed files with 12635 additions and 4774 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,30 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
//
// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.ranges.contains
import kotlin.ranges.reversed
/**
* Reverses elements in the list in-place.
*/
public actual fun <T> MutableList<T>.reverse(): Unit {
val midPoint = (size / 2) - 1
if (midPoint < 0) return
var reverseIndex = lastIndex
for (index in 0..midPoint) {
val tmp = this[index]
this[index] = this[reverseIndex]
this[reverseIndex] = tmp
reverseIndex--
}
}
@@ -0,0 +1,445 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.comparisons
//
// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
/**
* Returns the greater of two values.
*
* If values are equal, returns the first one.
*/
@SinceKotlin("1.1")
public actual fun <T : Comparable<T>> maxOf(a: T, b: T): T {
return if (a >= b) a else b
}
/**
* Returns the greater of two values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Byte, b: Byte): Byte {
return maxOf(a.toInt(), b.toInt()).toByte()
}
/**
* Returns the greater of two values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Short, b: Short): Short {
return maxOf(a.toInt(), b.toInt()).toShort()
}
/**
* Returns the greater of two values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Int, b: Int): Int {
return if (a >= b) a else b
}
/**
* Returns the greater of two values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Long, b: Long): Long {
return if (a >= b) a else b
}
/**
* Returns the greater of two values.
*
* If either value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Float, b: Float): Float {
return if (a.compareTo(b) >= 0) a else b
}
/**
* Returns the greater of two values.
*
* If either value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Double, b: Double): Double {
return if (a.compareTo(b) >= 0) a else b
}
/**
* Returns the greater of three values.
*
* If there are multiple equal maximal values, returns the first of them.
*/
@SinceKotlin("1.1")
public actual fun <T : Comparable<T>> maxOf(a: T, b: T, c: T): T {
return maxOf(a, maxOf(b, c))
}
/**
* Returns the greater of three values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Byte, b: Byte, c: Byte): Byte {
return maxOf(a.toInt(), maxOf(b.toInt(), c.toInt())).toByte()
}
/**
* Returns the greater of three values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Short, b: Short, c: Short): Short {
return maxOf(a.toInt(), maxOf(b.toInt(), c.toInt())).toShort()
}
/**
* Returns the greater of three values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Int, b: Int, c: Int): Int {
return maxOf(a, maxOf(b, c))
}
/**
* Returns the greater of three values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Long, b: Long, c: Long): Long {
return maxOf(a, maxOf(b, c))
}
/**
* Returns the greater of three values.
*
* If any value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Float, b: Float, c: Float): Float {
return maxOf(a, maxOf(b, c))
}
/**
* Returns the greater of three values.
*
* If any value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun maxOf(a: Double, b: Double, c: Double): Double {
return maxOf(a, maxOf(b, c))
}
/**
* Returns the greater of the given values.
*
* If there are multiple equal maximal values, returns the first of them.
*/
@SinceKotlin("1.4")
public actual fun <T : Comparable<T>> maxOf(a: T, vararg other: T): T {
var max = a
for (e in other) max = maxOf(max, e)
return max
}
/**
* Returns the greater of the given values.
*/
@SinceKotlin("1.4")
public actual fun maxOf(a: Byte, vararg other: Byte): Byte {
var max = a
for (e in other) max = maxOf(max, e)
return max
}
/**
* Returns the greater of the given values.
*/
@SinceKotlin("1.4")
public actual fun maxOf(a: Short, vararg other: Short): Short {
var max = a
for (e in other) max = maxOf(max, e)
return max
}
/**
* Returns the greater of the given values.
*/
@SinceKotlin("1.4")
public actual fun maxOf(a: Int, vararg other: Int): Int {
var max = a
for (e in other) max = maxOf(max, e)
return max
}
/**
* Returns the greater of the given values.
*/
@SinceKotlin("1.4")
public actual fun maxOf(a: Long, vararg other: Long): Long {
var max = a
for (e in other) max = maxOf(max, e)
return max
}
/**
* Returns the greater of the given values.
*
* If any value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.4")
public actual fun maxOf(a: Float, vararg other: Float): Float {
var max = a
for (e in other) max = maxOf(max, e)
return max
}
/**
* Returns the greater of the given values.
*
* If any value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.4")
public actual fun maxOf(a: Double, vararg other: Double): Double {
var max = a
for (e in other) max = maxOf(max, e)
return max
}
/**
* Returns the smaller of two values.
*
* If values are equal, returns the first one.
*/
@SinceKotlin("1.1")
public actual fun <T : Comparable<T>> minOf(a: T, b: T): T {
return if (a <= b) a else b
}
/**
* Returns the smaller of two values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Byte, b: Byte): Byte {
return minOf(a.toInt(), b.toInt()).toByte()
}
/**
* Returns the smaller of two values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Short, b: Short): Short {
return minOf(a.toInt(), b.toInt()).toShort()
}
/**
* Returns the smaller of two values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Int, b: Int): Int {
return if (a <= b) a else b
}
/**
* Returns the smaller of two values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Long, b: Long): Long {
return if (a <= b) a else b
}
/**
* Returns the smaller of two values.
*
* If either value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Float, b: Float): Float {
return when {
a.isNaN() -> a
b.isNaN() -> b
else -> if (a.compareTo(b) <= 0) a else b
}
}
/**
* Returns the smaller of two values.
*
* If either value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Double, b: Double): Double {
return when {
a.isNaN() -> a
b.isNaN() -> b
else -> if (a.compareTo(b) <= 0) a else b
}
}
/**
* Returns the smaller of three values.
*
* If there are multiple equal minimal values, returns the first of them.
*/
@SinceKotlin("1.1")
public actual fun <T : Comparable<T>> minOf(a: T, b: T, c: T): T {
return minOf(a, minOf(b, c))
}
/**
* Returns the smaller of three values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Byte, b: Byte, c: Byte): Byte {
return minOf(a.toInt(), minOf(b.toInt(), c.toInt())).toByte()
}
/**
* Returns the smaller of three values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Short, b: Short, c: Short): Short {
return minOf(a.toInt(), minOf(b.toInt(), c.toInt())).toShort()
}
/**
* Returns the smaller of three values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Int, b: Int, c: Int): Int {
return minOf(a, minOf(b, c))
}
/**
* Returns the smaller of three values.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Long, b: Long, c: Long): Long {
return minOf(a, minOf(b, c))
}
/**
* Returns the smaller of three values.
*
* If any value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Float, b: Float, c: Float): Float {
return minOf(a, minOf(b, c))
}
/**
* Returns the smaller of three values.
*
* If any value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public actual inline fun minOf(a: Double, b: Double, c: Double): Double {
return minOf(a, minOf(b, c))
}
/**
* Returns the smaller of the given values.
*
* If there are multiple equal minimal values, returns the first of them.
*/
@SinceKotlin("1.4")
public actual fun <T : Comparable<T>> minOf(a: T, vararg other: T): T {
var min = a
for (e in other) min = minOf(min, e)
return min
}
/**
* Returns the smaller of the given values.
*/
@SinceKotlin("1.4")
public actual fun minOf(a: Byte, vararg other: Byte): Byte {
var min = a
for (e in other) min = minOf(min, e)
return min
}
/**
* Returns the smaller of the given values.
*/
@SinceKotlin("1.4")
public actual fun minOf(a: Short, vararg other: Short): Short {
var min = a
for (e in other) min = minOf(min, e)
return min
}
/**
* Returns the smaller of the given values.
*/
@SinceKotlin("1.4")
public actual fun minOf(a: Int, vararg other: Int): Int {
var min = a
for (e in other) min = minOf(min, e)
return min
}
/**
* Returns the smaller of the given values.
*/
@SinceKotlin("1.4")
public actual fun minOf(a: Long, vararg other: Long): Long {
var min = a
for (e in other) min = minOf(min, e)
return min
}
/**
* Returns the smaller of the given values.
*
* If any value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.4")
public actual fun minOf(a: Float, vararg other: Float): Float {
var min = a
for (e in other) min = minOf(min, e)
return min
}
/**
* Returns the smaller of the given values.
*
* If any value is `NaN`, returns `NaN`.
*/
@SinceKotlin("1.4")
public actual fun minOf(a: Double, vararg other: Double): Double {
var min = a
for (e in other) min = minOf(min, e)
return min
}
@@ -0,0 +1,23 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.text
//
// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
/**
* Returns a character at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this char sequence.
*
* @sample samples.collections.Collections.Elements.elementAt
*/
@kotlin.internal.InlineOnly
public actual inline fun CharSequence.elementAt(index: Int): Char {
return get(index)
}
@@ -0,0 +1,127 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
//
// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.ranges.contains
import kotlin.ranges.reversed
/**
* Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
*
* @sample samples.collections.Collections.Elements.elementAt
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public actual inline fun UIntArray.elementAt(index: Int): UInt {
return get(index)
}
/**
* Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
*
* @sample samples.collections.Collections.Elements.elementAt
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public actual inline fun ULongArray.elementAt(index: Int): ULong {
return get(index)
}
/**
* Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
*
* @sample samples.collections.Collections.Elements.elementAt
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public actual inline fun UByteArray.elementAt(index: Int): UByte {
return get(index)
}
/**
* Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
*
* @sample samples.collections.Collections.Elements.elementAt
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public actual inline fun UShortArray.elementAt(index: Int): UShort {
return get(index)
}
/**
* Returns a [List] that wraps the original array.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public actual fun UIntArray.asList(): List<UInt> {
return object : AbstractList<UInt>(), RandomAccess {
override val size: Int get() = this@asList.size
override fun isEmpty(): Boolean = this@asList.isEmpty()
override fun contains(element: UInt): Boolean = this@asList.contains(element)
override fun get(index: Int): UInt = this@asList[index]
override fun indexOf(element: UInt): Int = this@asList.indexOf(element)
override fun lastIndexOf(element: UInt): Int = this@asList.lastIndexOf(element)
}
}
/**
* Returns a [List] that wraps the original array.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public actual fun ULongArray.asList(): List<ULong> {
return object : AbstractList<ULong>(), RandomAccess {
override val size: Int get() = this@asList.size
override fun isEmpty(): Boolean = this@asList.isEmpty()
override fun contains(element: ULong): Boolean = this@asList.contains(element)
override fun get(index: Int): ULong = this@asList[index]
override fun indexOf(element: ULong): Int = this@asList.indexOf(element)
override fun lastIndexOf(element: ULong): Int = this@asList.lastIndexOf(element)
}
}
/**
* Returns a [List] that wraps the original array.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public actual fun UByteArray.asList(): List<UByte> {
return object : AbstractList<UByte>(), RandomAccess {
override val size: Int get() = this@asList.size
override fun isEmpty(): Boolean = this@asList.isEmpty()
override fun contains(element: UByte): Boolean = this@asList.contains(element)
override fun get(index: Int): UByte = this@asList[index]
override fun indexOf(element: UByte): Int = this@asList.indexOf(element)
override fun lastIndexOf(element: UByte): Int = this@asList.lastIndexOf(element)
}
}
/**
* Returns a [List] that wraps the original array.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public actual fun UShortArray.asList(): List<UShort> {
return object : AbstractList<UShort>(), RandomAccess {
override val size: Int get() = this@asList.size
override fun isEmpty(): Boolean = this@asList.isEmpty()
override fun contains(element: UShort): Boolean = this@asList.contains(element)
override fun get(index: Int): UShort = this@asList[index]
override fun indexOf(element: UShort): Int = this@asList.indexOf(element)
override fun lastIndexOf(element: UShort): Int = this@asList.lastIndexOf(element)
}
}
@@ -0,0 +1,95 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin
public actual open class Exception actual constructor(message: String?, cause: Throwable?) : Throwable(message, cause) {
actual constructor() : this(null, null)
actual constructor(message: String?) : this(message, null)
actual constructor(cause: Throwable?) : this(null, cause)
}
public actual open class Error actual constructor(message: String?, cause: Throwable?) : Throwable(message, cause) {
actual constructor() : this(null, null)
actual constructor(message: String?) : this(message, null)
actual constructor(cause: Throwable?) : this(null, cause)
}
public actual open class RuntimeException actual constructor(message: String?, cause: Throwable?) : Exception(message, cause) {
actual constructor() : this(null, null)
actual constructor(message: String?) : this(message, null)
actual constructor(cause: Throwable?) : this(null, cause)
}
public actual open class IllegalArgumentException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {
actual constructor() : this(null, null)
actual constructor(message: String?) : this(message, null)
actual constructor(cause: Throwable?) : this(null, cause)
}
public actual open class IllegalStateException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {
actual constructor() : this(null, null)
actual constructor(message: String?) : this(message, null)
actual constructor(cause: Throwable?) : this(null, cause)
}
public actual open class IndexOutOfBoundsException actual constructor(message: String?) : RuntimeException(message) {
actual constructor() : this(null)
}
public actual open class ConcurrentModificationException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {
actual constructor() : this(null, null)
actual constructor(message: String?) : this(message, null)
actual constructor(cause: Throwable?) : this(null, cause)
}
public actual open class UnsupportedOperationException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {
actual constructor() : this(null, null)
actual constructor(message: String?) : this(message, null)
actual constructor(cause: Throwable?) : this(null, cause)
}
public actual open class NumberFormatException actual constructor(message: String?) : IllegalArgumentException(message) {
actual constructor() : this(null)
}
public actual open class NullPointerException actual constructor(message: String?) : RuntimeException(message) {
actual constructor() : this(null)
}
public actual open class ClassCastException actual constructor(message: String?) : RuntimeException(message) {
actual constructor() : this(null)
}
public actual open class AssertionError private constructor(message: String?, cause: Throwable?) : Error(message, cause) {
actual constructor() : this(null)
constructor(message: String?) : this(message, null)
actual constructor(message: Any?) : this(message.toString(), message as? Throwable)
}
public actual open class NoSuchElementException actual constructor(message: String?) : RuntimeException(message) {
actual constructor() : this(null)
}
@SinceKotlin("1.3")
public actual open class ArithmeticException actual constructor(message: String?) : RuntimeException(message) {
actual constructor() : this(null)
}
public actual open class NoWhenBranchMatchedException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {
actual constructor() : this(null, null)
actual constructor(message: String?) : this(message, null)
actual constructor(cause: Throwable?) : this(null, cause)
}
public actual open class UninitializedPropertyAccessException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {
actual constructor() : this(null, null)
actual constructor(message: String?) : this(message, null)
actual constructor(cause: Throwable?) : this(null, cause)
}
+107
View File
@@ -0,0 +1,107 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin
import kotlin.annotation.AnnotationTarget.FIELD
import kotlin.annotation.AnnotationTarget.PROPERTY
/**
* Provides a comparison function for imposing a total ordering between instances of the type [T].
*/
public actual fun interface Comparator<T> {
/**
* Compares its two arguments for order. Returns zero if the arguments are equal,
* a negative number if the first argument is less than the second, or a positive number
* if the first argument is greater than the second.
*/
public actual fun compare(a: T, b: T): Int
}
// From kotlin.kt
// From numbers.kt
actual fun Double.isNaN(): Boolean = TODO("Wasm stdlib: Kotlin")
actual fun Float.isNaN(): Boolean = TODO("Wasm stdlib: Kotlin")
actual fun Double.isInfinite(): Boolean = TODO("Wasm stdlib: Kotlin")
actual fun Float.isInfinite(): Boolean = TODO("Wasm stdlib: Kotlin")
actual fun Double.isFinite(): Boolean = TODO("Wasm stdlib: Kotlin")
actual fun Float.isFinite(): Boolean = TODO("Wasm stdlib: Kotlin")
/**
* Returns a bit representation of the specified floating-point value as [Long]
* according to the IEEE 754 floating-point "double format" bit layout.
*/
@SinceKotlin("1.2")
public actual fun Double.toBits(): Long = TODO("Wasm stdlib: Kotlin")
/**
* Returns a bit representation of the specified floating-point value as [Long]
* according to the IEEE 754 floating-point "double format" bit layout,
* preserving `NaN` values exact layout.
*/
@SinceKotlin("1.2")
public actual fun Double.toRawBits(): Long = TODO("Wasm stdlib: Kotlin")
/**
* Returns the [Double] value corresponding to a given bit representation.
*/
@SinceKotlin("1.2")
public actual fun Double.Companion.fromBits(bits: Long): Double = TODO("Wasm stdlib: Kotlin")
/**
* Returns a bit representation of the specified floating-point value as [Int]
* according to the IEEE 754 floating-point "single format" bit layout.
*/
@SinceKotlin("1.2")
public actual fun Float.toBits(): Int = TODO("Wasm stdlib: Kotlin")
/**
* Returns a bit representation of the specified floating-point value as [Int]
* according to the IEEE 754 floating-point "single format" bit layout,
* preserving `NaN` values exact layout.
*/
@SinceKotlin("1.2")
public actual fun Float.toRawBits(): Int = TODO("Wasm stdlib: Kotlin")
/**
* Returns the [Float] value corresponding to a given bit representation.
*/
@SinceKotlin("1.2")
public actual fun Float.Companion.fromBits(bits: Int): Float = TODO("Wasm stdlib: Kotlin")
// From concurrent.kt
// TODO: promote to error? Otherwise it gets to JVM part
//@Deprecated("Use Volatile annotation from kotlin.jvm package", ReplaceWith("kotlin.jvm.Volatile"), level = DeprecationLevel.WARNING)
//public typealias Volatile = kotlin.jvm.Volatile
@Deprecated("Synchronization on any object is not supported on every platform and will be removed from the common standard library soon.")
public actual inline fun <R> synchronized(lock: Any, block: () -> R): R = TODO("Wasm stdlib: Kotlin")
// from lazy.kt
public actual fun <T> lazy(initializer: () -> T): Lazy<T> = TODO("Wasm stdlib: Kotlin")
/**
* Creates a new instance of the [Lazy] that uses the specified initialization function [initializer].
*
* The [mode] parameter is ignored. */
public actual fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T> = TODO("Wasm stdlib: Kotlin")
/**
* Creates a new instance of the [Lazy] that uses the specified initialization function [initializer].
*
* The [lock] parameter is ignored.
*/
public actual fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T> = TODO("Wasm stdlib: Kotlin")
+990
View File
@@ -0,0 +1,990 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.math
// region ================ Double Math ========================================
/** Computes the sine of the angle [x] given in radians.
*
* Special cases:
* - `sin(NaN|+Inf|-Inf)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun sin(x: Double): Double = TODO("Wasm stdlib: Math")
/** Computes the cosine of the angle [x] given in radians.
*
* Special cases:
* - `cos(NaN|+Inf|-Inf)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun cos(x: Double): Double = TODO("Wasm stdlib: Math")
/** Computes the tangent of the angle [x] given in radians.
*
* Special cases:
* - `tan(NaN|+Inf|-Inf)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun tan(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the arc sine of the value [x];
* the returned value is an angle in the range from `-PI/2` to `PI/2` radians.
*
* Special cases:
* - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`
*/
@SinceKotlin("1.2")
public actual fun asin(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the arc cosine of the value [x];
* the returned value is an angle in the range from `0.0` to `PI` radians.
*
* Special cases:
* - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`
*/
@SinceKotlin("1.2")
public actual fun acos(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the arc tangent of the value [x];
* the returned value is an angle in the range from `-PI/2` to `PI/2` radians.
*
* Special cases:
* - `atan(NaN)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun atan(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond
* to the rectangular coordinates `(x, y)` by computing the arc tangent of the value [y] / [x];
* the returned value is an angle in the range from `-PI` to `PI` radians.
*
* Special cases:
* - `atan2(0.0, 0.0)` is `0.0`
* - `atan2(0.0, x)` is `0.0` for `x > 0` and `PI` for `x < 0`
* - `atan2(-0.0, x)` is `-0.0` for 'x > 0` and `-PI` for `x < 0`
* - `atan2(y, +Inf)` is `0.0` for `0 < y < +Inf` and `-0.0` for '-Inf < y < 0`
* - `atan2(y, -Inf)` is `PI` for `0 < y < +Inf` and `-PI` for `-Inf < y < 0`
* - `atan2(y, 0.0)` is `PI/2` for `y > 0` and `-PI/2` for `y < 0`
* - `atan2(+Inf, x)` is `PI/2` for finite `x`y
* - `atan2(-Inf, x)` is `-PI/2` for finite `x`
* - `atan2(NaN, x)` and `atan2(y, NaN)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun atan2(y: Double, x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the hyperbolic sine of the value [x].
*
* Special cases:
* - `sinh(NaN)` is `NaN`
* - `sinh(+Inf)` is `+Inf`
* - `sinh(-Inf)` is `-Inf`
*/
@SinceKotlin("1.2")
public actual fun sinh(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the hyperbolic cosine of the value [x].
*
* Special cases:
* - `cosh(NaN)` is `NaN`
* - `cosh(+Inf|-Inf)` is `+Inf`
*/
@SinceKotlin("1.2")
public actual fun cosh(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the hyperbolic tangent of the value [x].
*
* Special cases:
* - `tanh(NaN)` is `NaN`
* - `tanh(+Inf)` is `1.0`
* - `tanh(-Inf)` is `-1.0`
*/
@SinceKotlin("1.2")
public actual fun tanh(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the inverse hyperbolic sine of the value [x].
*
* The returned value is `y` such that `sinh(y) == x`.
*
* Special cases:
* - `asinh(NaN)` is `NaN`
* - `asinh(+Inf)` is `+Inf`
* - `asinh(-Inf)` is `-Inf`
*/
@SinceKotlin("1.2")
public actual fun asinh(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the inverse hyperbolic cosine of the value [x].
*
* The returned value is positive `y` such that `cosh(y) == x`.
*
* Special cases:
* - `acosh(NaN)` is `NaN`
* - `acosh(x)` is `NaN` when `x < 1`
* - `acosh(+Inf)` is `+Inf`
*/
@SinceKotlin("1.2")
public actual fun acosh(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the inverse hyperbolic tangent of the value [x].
*
* The returned value is `y` such that `tanh(y) == x`.
*
* Special cases:
* - `tanh(NaN)` is `NaN`
* - `tanh(x)` is `NaN` when `x > 1` or `x < -1`
* - `tanh(1.0)` is `+Inf`
* - `tanh(-1.0)` is `-Inf`
*/
@SinceKotlin("1.2")
public actual fun atanh(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow.
*
* Special cases:
* - returns `+Inf` if any of arguments is infinite
* - returns `NaN` if any of arguments is `NaN` and the other is not infinite
*/
@SinceKotlin("1.2")
public actual fun hypot(x: Double, y: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the positive square root of the value [x].
*
* Special cases:
* - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun sqrt(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes Euler's number `e` raised to the power of the value [x].
*
* Special cases:
* - `exp(NaN)` is `NaN`
* - `exp(+Inf)` is `+Inf`
* - `exp(-Inf)` is `0.0`
*/
@SinceKotlin("1.2")
public actual fun exp(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes `exp(x) - 1`.
*
* This function can be implemented to produce more precise result for [x] near zero.
*
* Special cases:
* - `expm1(NaN)` is `NaN`
* - `expm1(+Inf)` is `+Inf`
* - `expm1(-Inf)` is `-1.0`
*
* @see [exp] function.
*/
@SinceKotlin("1.2")
public actual fun expm1(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the logarithm of the value [x] to the given [base].
*
* Special cases:
* - `log(x, b)` is `NaN` if either `x` or `b` are `NaN`
* - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0`
* - `log(+Inf, +Inf)` is `NaN`
* - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1`
* - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1`
*
* See also logarithm functions for common fixed bases: [ln], [log10] and [log2].
*/
@SinceKotlin("1.2")
public actual fun log(x: Double, base: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the natural logarithm (base `E`) of the value [x].
*
* Special cases:
* - `ln(NaN)` is `NaN`
* - `ln(x)` is `NaN` when `x < 0.0`
* - `ln(+Inf)` is `+Inf`
* - `ln(0.0)` is `-Inf`
*/
@SinceKotlin("1.2")
public actual fun ln(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the common logarithm (base 10) of the value [x].
*
* @see [ln] function for special cases.
*/
@SinceKotlin("1.2")
public actual fun log10(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes the binary logarithm (base 2) of the value [x].
*
* @see [ln] function for special cases.
*/
@SinceKotlin("1.2")
public actual fun log2(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Computes `ln(x + 1)`.
*
* This function can be implemented to produce more precise result for [x] near zero.
*
* Special cases:
* - `ln1p(NaN)` is `NaN`
* - `ln1p(x)` is `NaN` where `x < -1.0`
* - `ln1p(-1.0)` is `-Inf`
* - `ln1p(+Inf)` is `+Inf`
*
* @see [ln] function
* @see [expm1] function
*/
@SinceKotlin("1.2")
public actual fun ln1p(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Rounds the given value [x] to an integer towards positive infinity.
* @return the smallest double value that is greater than or equal to the given value [x] and is a mathematical integer.
*
* Special cases:
* - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
*/
@SinceKotlin("1.2")
public actual fun ceil(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Rounds the given value [x] to an integer towards negative infinity.
* @return the largest double value that is smaller than or equal to the given value [x] and is a mathematical integer.
*
* Special cases:
* - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
*/
@SinceKotlin("1.2")
public actual fun floor(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Rounds the given value [x] to an integer towards zero.
*
* @return the value [x] having its fractional part truncated.
*
* Special cases:
* - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
*/
@SinceKotlin("1.2")
public actual fun truncate(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Rounds the given value [x] towards the closest integer with ties rounded towards even integer.
*
* Special cases:
* - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
*/
@SinceKotlin("1.2")
public actual fun round(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Returns the absolute value of the given value [x].
*
* Special cases:
* - `abs(NaN)` is `NaN`
*
* @see absoluteValue extension property for [Double]
*/
@SinceKotlin("1.2")
public actual fun abs(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Returns the sign of the given value [x]:
* - `-1.0` if the value is negative,
* - zero if the value is zero,
* - `1.0` if the value is positive
*
* Special case:
* - `sign(NaN)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun sign(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Returns the smaller of two values.
*
* If either value is `NaN`, then the result is `NaN`.
*/
@SinceKotlin("1.2")
public actual fun min(a: Double, b: Double): Double = TODO("Wasm stdlib: Math")
/**
* Returns the greater of two values.
*
* If either value is `NaN`, then the result is `NaN`.
*/
@SinceKotlin("1.2")
public actual fun max(a: Double, b: Double): Double = TODO("Wasm stdlib: Math")
// extensions
/**
* Raises this value to the power [x].
*
* Special cases:
* - `b.pow(0.0)` is `1.0`
* - `b.pow(1.0) == b`
* - `b.pow(NaN)` is `NaN`
* - `NaN.pow(x)` is `NaN` for `x != 0.0`
* - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0`
* - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer
*/
@SinceKotlin("1.2")
public actual fun Double.pow(x: Double): Double = TODO("Wasm stdlib: Math")
/**
* Raises this value to the integer power [n].
*
* See the other overload of [pow] for details.
*/
@SinceKotlin("1.2")
public actual fun Double.pow(n: Int): Double = TODO("Wasm stdlib: Math")
/**
* Returns the absolute value of this value.
*
* Special cases:
* - `NaN.absoluteValue` is `NaN`
*
* @see abs function
*/
@SinceKotlin("1.2")
public actual val Double.absoluteValue: Double get() = TODO("Wasm stdlib: Math")
/**
* Returns the sign of this value:
* - `-1.0` if the value is negative,
* - zero if the value is zero,
* - `1.0` if the value is positive
*
* Special case:
* - `NaN.sign` is `NaN`
*/
@SinceKotlin("1.2")
public actual val Double.sign: Double get() = TODO("Wasm stdlib: Math")
/**
* Returns this value with the sign bit same as of the [sign] value.
*
* If [sign] is `NaN` the sign of the result is undefined.
*/
@SinceKotlin("1.2")
public actual fun Double.withSign(sign: Double): Double = TODO("Wasm stdlib: Math")
/**
* Returns this value with the sign bit same as of the [sign] value.
*/
@SinceKotlin("1.2")
public actual fun Double.withSign(sign: Int): Double = TODO("Wasm stdlib: Math")
/**
* Returns the ulp (unit in the last place) of this value.
*
* An ulp is a positive distance between this value and the next nearest [Double] value larger in magnitude.
*
* Special Cases:
* - `NaN.ulp` is `NaN`
* - `x.ulp` is `+Inf` when `x` is `+Inf` or `-Inf`
* - `0.0.ulp` is `Double.MIN_VALUE`
*/
@SinceKotlin("1.2")
public actual val Double.ulp: Double get() = TODO("Wasm stdlib: Math")
/**
* Returns the [Double] value nearest to this value in direction of positive infinity.
*/
@SinceKotlin("1.2")
public actual fun Double.nextUp(): Double = TODO("Wasm stdlib: Math")
/**
* Returns the [Double] value nearest to this value in direction of negative infinity.
*/
@SinceKotlin("1.2")
public actual fun Double.nextDown(): Double = TODO("Wasm stdlib: Math")
/**
* Returns the [Double] value nearest to this value in direction from this value towards the value [to].
*
* Special cases:
* - `x.nextTowards(y)` is `NaN` if either `x` or `y` are `NaN`
* - `x.nextTowards(x) == x`
*
*/
@SinceKotlin("1.2")
public actual fun Double.nextTowards(to: Double): Double = TODO("Wasm stdlib: Math")
/**
* Rounds this [Double] value to the nearest integer and converts the result to [Int].
* Ties are rounded towards positive infinity.
*
* Special cases:
* - `x.roundToInt() == Int.MAX_VALUE` when `x > Int.MAX_VALUE`
* - `x.roundToInt() == Int.MIN_VALUE` when `x < Int.MIN_VALUE`
*
* @throws IllegalArgumentException when this value is `NaN`
*/
@SinceKotlin("1.2")
public actual fun Double.roundToInt(): Int = TODO("Wasm stdlib: Math")
/**
* Rounds this [Double] value to the nearest integer and converts the result to [Long].
* Ties are rounded towards positive infinity.
*
* Special cases:
* - `x.roundToLong() == Long.MAX_VALUE` when `x > Long.MAX_VALUE`
* - `x.roundToLong() == Long.MIN_VALUE` when `x < Long.MIN_VALUE`
*
* @throws IllegalArgumentException when this value is `NaN`
*/
@SinceKotlin("1.2")
public actual fun Double.roundToLong(): Long = TODO("Wasm stdlib: Math")
// endregion
// region ================ Float Math ========================================
/** Computes the sine of the angle [x] given in radians.
*
* Special cases:
* - `sin(NaN|+Inf|-Inf)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun sin(x: Float): Float = TODO("Wasm stdlib: Math")
/** Computes the cosine of the angle [x] given in radians.
*
* Special cases:
* - `cos(NaN|+Inf|-Inf)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun cos(x: Float): Float = TODO("Wasm stdlib: Math")
/** Computes the tangent of the angle [x] given in radians.
*
* Special cases:
* - `tan(NaN|+Inf|-Inf)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun tan(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the arc sine of the value [x];
* the returned value is an angle in the range from `-PI/2` to `PI/2` radians.
*
* Special cases:
* - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`
*/
@SinceKotlin("1.2")
public actual fun asin(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the arc cosine of the value [x];
* the returned value is an angle in the range from `0.0` to `PI` radians.
*
* Special cases:
* - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`
*/
@SinceKotlin("1.2")
public actual fun acos(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the arc tangent of the value [x];
* the returned value is an angle in the range from `-PI/2` to `PI/2` radians.
*
* Special cases:
* - `atan(NaN)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun atan(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond
* to the rectangular coordinates `(x, y)` by computing the arc tangent of the value [y] / [x];
* the returned value is an angle in the range from `-PI` to `PI` radians.
*
* Special cases:
* - `atan2(0.0, 0.0)` is `0.0`
* - `atan2(0.0, x)` is `0.0` for `x > 0` and `PI` for `x < 0`
* - `atan2(-0.0, x)` is `-0.0` for 'x > 0` and `-PI` for `x < 0`
* - `atan2(y, +Inf)` is `0.0` for `0 < y < +Inf` and `-0.0` for '-Inf < y < 0`
* - `atan2(y, -Inf)` is `PI` for `0 < y < +Inf` and `-PI` for `-Inf < y < 0`
* - `atan2(y, 0.0)` is `PI/2` for `y > 0` and `-PI/2` for `y < 0`
* - `atan2(+Inf, x)` is `PI/2` for finite `x`y
* - `atan2(-Inf, x)` is `-PI/2` for finite `x`
* - `atan2(NaN, x)` and `atan2(y, NaN)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun atan2(y: Float, x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the hyperbolic sine of the value [x].
*
* Special cases:
* - `sinh(NaN)` is `NaN`
* - `sinh(+Inf)` is `+Inf`
* - `sinh(-Inf)` is `-Inf`
*/
@SinceKotlin("1.2")
public actual fun sinh(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the hyperbolic cosine of the value [x].
*
* Special cases:
* - `cosh(NaN)` is `NaN`
* - `cosh(+Inf|-Inf)` is `+Inf`
*/
@SinceKotlin("1.2")
public actual fun cosh(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the hyperbolic tangent of the value [x].
*
* Special cases:
* - `tanh(NaN)` is `NaN`
* - `tanh(+Inf)` is `1.0`
* - `tanh(-Inf)` is `-1.0`
*/
@SinceKotlin("1.2")
public actual fun tanh(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the inverse hyperbolic sine of the value [x].
*
* The returned value is `y` such that `sinh(y) == x`.
*
* Special cases:
* - `asinh(NaN)` is `NaN`
* - `asinh(+Inf)` is `+Inf`
* - `asinh(-Inf)` is `-Inf`
*/
@SinceKotlin("1.2")
public actual fun asinh(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the inverse hyperbolic cosine of the value [x].
*
* The returned value is positive `y` such that `cosh(y) == x`.
*
* Special cases:
* - `acosh(NaN)` is `NaN`
* - `acosh(x)` is `NaN` when `x < 1`
* - `acosh(+Inf)` is `+Inf`
*/
@SinceKotlin("1.2")
public actual fun acosh(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the inverse hyperbolic tangent of the value [x].
*
* The returned value is `y` such that `tanh(y) == x`.
*
* Special cases:
* - `tanh(NaN)` is `NaN`
* - `tanh(x)` is `NaN` when `x > 1` or `x < -1`
* - `tanh(1.0)` is `+Inf`
* - `tanh(-1.0)` is `-Inf`
*/
@SinceKotlin("1.2")
public actual fun atanh(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow.
*
* Special cases:
* - returns `+Inf` if any of arguments is infinite
* - returns `NaN` if any of arguments is `NaN` and the other is not infinite
*/
@SinceKotlin("1.2")
public actual fun hypot(x: Float, y: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the positive square root of the value [x].
*
* Special cases:
* - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun sqrt(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes Euler's number `e` raised to the power of the value [x].
*
* Special cases:
* - `exp(NaN)` is `NaN`
* - `exp(+Inf)` is `+Inf`
* - `exp(-Inf)` is `0.0`
*/
@SinceKotlin("1.2")
public actual fun exp(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes `exp(x) - 1`.
*
* This function can be implemented to produce more precise result for [x] near zero.
*
* Special cases:
* - `expm1(NaN)` is `NaN`
* - `expm1(+Inf)` is `+Inf`
* - `expm1(-Inf)` is `-1.0`
*
* @see [exp] function.
*/
@SinceKotlin("1.2")
public actual fun expm1(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the logarithm of the value [x] to the given [base].
*
* Special cases:
* - `log(x, b)` is `NaN` if either `x` or `b` are `NaN`
* - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0`
* - `log(+Inf, +Inf)` is `NaN`
* - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1`
* - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1`
*
* See also logarithm functions for common fixed bases: [ln], [log10] and [log2].
*/
@SinceKotlin("1.2")
public actual fun log(x: Float, base: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the natural logarithm (base `E`) of the value [x].
*
* Special cases:
* - `ln(NaN)` is `NaN`
* - `ln(x)` is `NaN` when `x < 0.0`
* - `ln(+Inf)` is `+Inf`
* - `ln(0.0)` is `-Inf`
*/
@SinceKotlin("1.2")
public actual fun ln(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the common logarithm (base 10) of the value [x].
*
* @see [ln] function for special cases.
*/
@SinceKotlin("1.2")
public actual fun log10(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes the binary logarithm (base 2) of the value [x].
*
* @see [ln] function for special cases.
*/
@SinceKotlin("1.2")
public actual fun log2(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Computes `ln(a + 1)`.
*
* This function can be implemented to produce more precise result for [x] near zero.
*
* Special cases:
* - `ln1p(NaN)` is `NaN`
* - `ln1p(x)` is `NaN` where `x < -1.0`
* - `ln1p(-1.0)` is `-Inf`
* - `ln1p(+Inf)` is `+Inf`
*
* @see [ln] function
* @see [expm1] function
*/
@SinceKotlin("1.2")
public actual fun ln1p(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Rounds the given value [x] to an integer towards positive infinity.
* @return the smallest Float value that is greater than or equal to the given value [x] and is a mathematical integer.
*
* Special cases:
* - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
*/
@SinceKotlin("1.2")
public actual fun ceil(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Rounds the given value [x] to an integer towards negative infinity.
* @return the largest Float value that is smaller than or equal to the given value [x] and is a mathematical integer.
*
* Special cases:
* - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
*/
@SinceKotlin("1.2")
public actual fun floor(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Rounds the given value [x] to an integer towards zero.
*
* @return the value [x] having its fractional part truncated.
*
* Special cases:
* - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
*/
@SinceKotlin("1.2")
public actual fun truncate(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Rounds the given value [x] towards the closest integer with ties rounded towards even integer.
*
* Special cases:
* - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
*/
@SinceKotlin("1.2")
public actual fun round(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Returns the absolute value of the given value [x].
*
* Special cases:
* - `abs(NaN)` is `NaN`
*
* @see absoluteValue extension property for [Float]
*/
@SinceKotlin("1.2")
public actual fun abs(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Returns the sign of the given value [x]:
* - `-1.0` if the value is negative,
* - zero if the value is zero,
* - `1.0` if the value is positive
*
* Special case:
* - `sign(NaN)` is `NaN`
*/
@SinceKotlin("1.2")
public actual fun sign(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Returns the smaller of two values.
*
* If either value is `NaN`, then the result is `NaN`.
*/
@SinceKotlin("1.2")
public actual fun min(a: Float, b: Float): Float = TODO("Wasm stdlib: Math")
/**
* Returns the greater of two values.
*
* If either value is `NaN`, then the result is `NaN`.
*/
@SinceKotlin("1.2")
public actual fun max(a: Float, b: Float): Float = TODO("Wasm stdlib: Math")
// extensions
/**
* Raises this value to the power [x].
*
* Special cases:
* - `b.pow(0.0)` is `1.0`
* - `b.pow(1.0) == b`
* - `b.pow(NaN)` is `NaN`
* - `NaN.pow(x)` is `NaN` for `x != 0.0`
* - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0`
* - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer
*/
@SinceKotlin("1.2")
public actual fun Float.pow(x: Float): Float = TODO("Wasm stdlib: Math")
/**
* Raises this value to the integer power [n].
*
* See the other overload of [pow] for details.
*/
@SinceKotlin("1.2")
public actual fun Float.pow(n: Int): Float = TODO("Wasm stdlib: Math")
/**
* Returns the absolute value of this value.
*
* Special cases:
* - `NaN.absoluteValue` is `NaN`
*
* @see abs function
*/
@SinceKotlin("1.2")
public actual val Float.absoluteValue: Float get() = TODO("Wasm stdlib: Math")
/**
* Returns the sign of this value:
* - `-1.0` if the value is negative,
* - zero if the value is zero,
* - `1.0` if the value is positive
*
* Special case:
* - `NaN.sign` is `NaN`
*/
@SinceKotlin("1.2")
public actual val Float.sign: Float get() = TODO("Wasm stdlib: Math")
/**
* Returns this value with the sign bit same as of the [sign] value.
*
* If [sign] is `NaN` the sign of the result is undefined.
*/
@SinceKotlin("1.2")
public actual fun Float.withSign(sign: Float): Float = TODO("Wasm stdlib: Math")
/**
* Returns this value with the sign bit same as of the [sign] value.
*/
@SinceKotlin("1.2")
public actual fun Float.withSign(sign: Int): Float = TODO("Wasm stdlib: Math")
/**
* Rounds this [Float] value to the nearest integer and converts the result to [Int].
* Ties are rounded towards positive infinity.
*
* Special cases:
* - `x.roundToInt() == Int.MAX_VALUE` when `x > Int.MAX_VALUE`
* - `x.roundToInt() == Int.MIN_VALUE` when `x < Int.MIN_VALUE`
*
* @throws IllegalArgumentException when this value is `NaN`
*/
@SinceKotlin("1.2")
public actual fun Float.roundToInt(): Int = TODO("Wasm stdlib: Math")
/**
* Rounds this [Float] value to the nearest integer and converts the result to [Long].
* Ties are rounded towards positive infinity.
*
* Special cases:
* - `x.roundToLong() == Long.MAX_VALUE` when `x > Long.MAX_VALUE`
* - `x.roundToLong() == Long.MIN_VALUE` when `x < Long.MIN_VALUE`
*
* @throws IllegalArgumentException when this value is `NaN`
*/
@SinceKotlin("1.2")
public actual fun Float.roundToLong(): Long = TODO("Wasm stdlib: Math")
// endregion
// region ================ Integer Math ========================================
/**
* Returns the absolute value of the given value [n].
*
* Special cases:
* - `abs(Int.MIN_VALUE)` is `Int.MIN_VALUE` due to an overflow
*
* @see absoluteValue extension property for [Int]
*/
@SinceKotlin("1.2")
public actual fun abs(n: Int): Int = TODO("Wasm stdlib: Math")
/**
* Returns the smaller of two values.
*/
@SinceKotlin("1.2")
public actual fun min(a: Int, b: Int): Int = TODO("Wasm stdlib: Math")
/**
* Returns the greater of two values.
*/
@SinceKotlin("1.2")
public actual fun max(a: Int, b: Int): Int = TODO("Wasm stdlib: Math")
/**
* Returns the absolute value of this value.
*
* Special cases:
* - `Int.MIN_VALUE.absoluteValue` is `Int.MIN_VALUE` due to an overflow
*
* @see abs function
*/
@SinceKotlin("1.2")
public actual val Int.absoluteValue: Int get() = TODO("Wasm stdlib: Math")
/**
* Returns the sign of this value:
* - `-1` if the value is negative,
* - `0` if the value is zero,
* - `1` if the value is positive
*/
@SinceKotlin("1.2")
public actual val Int.sign: Int get() = TODO("Wasm stdlib: Math")
/**
* Returns the absolute value of the given value [n].
*
* Special cases:
* - `abs(Long.MIN_VALUE)` is `Long.MIN_VALUE` due to an overflow
*
* @see absoluteValue extension property for [Long]
*/
@SinceKotlin("1.2")
public actual fun abs(n: Long): Long = TODO("Wasm stdlib: Math")
/**
* Returns the smaller of two values.
*/
@SinceKotlin("1.2")
public actual fun min(a: Long, b: Long): Long = TODO("Wasm stdlib: Math")
/**
* Returns the greater of two values.
*/
@SinceKotlin("1.2")
public actual fun max(a: Long, b: Long): Long = TODO("Wasm stdlib: Math")
/**
* Returns the absolute value of this value.
*
* Special cases:
* - `Long.MIN_VALUE.absoluteValue` is `Long.MIN_VALUE` due to an overflow
*
* @see abs function
*/
@SinceKotlin("1.2")
public actual val Long.absoluteValue: Long get() = TODO("Wasm stdlib: Math")
/**
* Returns the sign of this value:
* - `-1` if the value is negative,
* - `0` if the value is zero,
* - `1` if the value is positive
*/
@SinceKotlin("1.2")
public actual val Long.sign: Int get() = TODO("Wasm stdlib: Math")
// endregion
@@ -0,0 +1,12 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.sequences
internal actual class ConstrainedOnceSequence<T> : Sequence<T> {
actual constructor(sequence: Sequence<T>) { TODO("Wasm stdlib: ConstrainedOnceSequence") }
actual override fun iterator(): Iterator<T> = TODO("Wasm stdlib: ConstrainedOnceSequence")
}
+402
View File
@@ -0,0 +1,402 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.text
actual class Regex {
actual constructor(pattern: String) { TODO("Wasm stdlib: Text") }
actual constructor(pattern: String, option: RegexOption) { TODO("Wasm stdlib: Text") }
actual constructor(pattern: String, options: Set<RegexOption>) { TODO("Wasm stdlib: Text") }
actual val pattern: String = TODO("Wasm stdlib: Text")
actual val options: Set<RegexOption> = TODO("Wasm stdlib: Text")
actual fun matchEntire(input: CharSequence): MatchResult? = TODO("Wasm stdlib: Text")
actual infix fun matches(input: CharSequence): Boolean = TODO("Wasm stdlib: Text")
actual fun containsMatchIn(input: CharSequence): Boolean = TODO("Wasm stdlib: Text")
actual fun replace(input: CharSequence, replacement: String): String = TODO("Wasm stdlib: Text")
actual fun replace(input: CharSequence, transform: (MatchResult) -> CharSequence): String = TODO("Wasm stdlib: Text")
actual fun replaceFirst(input: CharSequence, replacement: String): String = TODO("Wasm stdlib: Text")
/**
* Returns the first match of a regular expression in the [input], beginning at the specified [startIndex].
*
* @param startIndex An index to start search with, by default 0. Must be not less than zero and not greater than `input.length()`
* @return An instance of [MatchResult] if match was found or `null` otherwise.
* @sample samples.text.Regexps.find
*/
actual fun find(input: CharSequence, startIndex: Int): MatchResult? = TODO("Wasm stdlib: Text")
/**
* Returns a sequence of all occurrences of a regular expression within the [input] string, beginning at the specified [startIndex].
*
* @sample samples.text.Regexps.findAll
*/
actual fun findAll(input: CharSequence, startIndex: Int): Sequence<MatchResult> = TODO("Wasm stdlib: Text")
/**
* Splits the [input] CharSequence around matches of this regular expression.
*
* @param limit Non-negative value specifying the maximum number of substrings the string can be split to.
* Zero by default means no limit is set.
*/
actual fun split(input: CharSequence, limit: Int): List<String> = TODO("Wasm stdlib: Text")
actual companion object {
actual fun fromLiteral(literal: String): Regex = TODO("Wasm stdlib: Text")
actual fun escape(literal: String): String = TODO("Wasm stdlib: Text")
actual fun escapeReplacement(literal: String): String = TODO("Wasm stdlib: Text")
}
}
actual class MatchGroup {
actual val value: String = TODO("Wasm stdlib: Text")
}
actual enum class RegexOption {
IGNORE_CASE,
MULTILINE
}
// From char.kt
actual fun Char.isWhitespace(): Boolean = TODO("Wasm stdlib: Text")
actual fun Char.toLowerCase(): Char = TODO("Wasm stdlib: Text")
actual fun Char.toUpperCase(): Char = TODO("Wasm stdlib: Text")
actual fun Char.isHighSurrogate(): Boolean = TODO("Wasm stdlib: Text")
actual fun Char.isLowSurrogate(): Boolean = TODO("Wasm stdlib: Text")
// From string.kt
/**
* Converts the characters in the specified array to a string.
*/
@SinceKotlin("1.2")
public actual fun String(chars: CharArray): String = TODO("Wasm stdlib: Text")
/**
* Converts the characters from a portion of the specified array to a string.
*
* @throws IndexOutOfBoundsException if either [offset] or [length] are less than zero
* or `offset + length` is out of [chars] array bounds.
*/
@SinceKotlin("1.2")
public actual fun String(chars: CharArray, offset: Int, length: Int): String = TODO("Wasm stdlib: Text")
/**
* Concatenates characters in this [CharArray] into a String.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun CharArray.concatToString(): String = TODO("Wasm stdlib: Text")
/**
* Concatenates characters in this [CharArray] or its subrange into a String.
*
* @param startIndex the beginning (inclusive) of the subrange of characters, 0 by default.
* @param endIndex the end (exclusive) of the subrange of characters, size of this array by default.
*
* @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun CharArray.concatToString(startIndex: Int, endIndex: Int): String = TODO("Wasm stdlib: Text")
/**
* Returns a [CharArray] containing characters of this string.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun String.toCharArray(): CharArray = TODO("Wasm stdlib: Text")
/**
* Returns a [CharArray] containing characters of this string or its substring.
*
* @param startIndex the beginning (inclusive) of the substring, 0 by default.
* @param endIndex the end (exclusive) of the substring, length of this string by default.
*
* @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the length of this string.
* @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun String.toCharArray(startIndex: Int, endIndex: Int): CharArray = TODO("Wasm stdlib: Text")
/**
* Decodes a string from the bytes in UTF-8 encoding in this array.
*
* Malformed byte sequences are replaced by the replacement char `\uFFFD`.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun ByteArray.decodeToString(): String = TODO("Wasm stdlib: Text")
/**
* Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.
*
* @param startIndex the beginning (inclusive) of the subrange to decode, 0 by default.
* @param endIndex the end (exclusive) of the subrange to decode, size of this array by default.
* @param throwOnInvalidSequence specifies whether to throw an exception on malformed byte sequence or replace it by the replacement char `\uFFFD`.
*
* @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
* @throws CharacterCodingException if the byte array contains malformed UTF-8 byte sequence and [throwOnInvalidSequence] is true.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun ByteArray.decodeToString(
startIndex: Int,
endIndex: Int,
throwOnInvalidSequence: Boolean
): String = TODO("Wasm stdlib: Text")
/**
* Encodes this string to an array of bytes in UTF-8 encoding.
*
* Any malformed char sequence is replaced by the replacement byte sequence.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun String.encodeToByteArray(): ByteArray = TODO("Wasm stdlib: Text")
/**
* Encodes this string or its substring to an array of bytes in UTF-8 encoding.
*
* @param startIndex the beginning (inclusive) of the substring to encode, 0 by default.
* @param endIndex the end (exclusive) of the substring to encode, length of this string by default.
* @param throwOnInvalidSequence specifies whether to throw an exception on malformed char sequence or replace.
*
* @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the length of this string.
* @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
* @throws CharacterCodingException if this string contains malformed char sequence and [throwOnInvalidSequence] is true.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun String.encodeToByteArray(
startIndex: Int,
endIndex: Int,
throwOnInvalidSequence: Boolean
): ByteArray = TODO("Wasm stdlib: Text")
internal actual fun String.nativeIndexOf(str: String, fromIndex: Int): Int = TODO("Wasm stdlib: Text")
internal actual fun String.nativeLastIndexOf(str: String, fromIndex: Int): Int = TODO("Wasm stdlib: Text")
public actual fun String.substring(startIndex: Int): String = TODO("Wasm stdlib: Text")
public actual fun String.substring(startIndex: Int, endIndex: Int): String = TODO("Wasm stdlib: Text")
/**
* Returns a copy of this string converted to upper case using the rules of the default locale.
*
* @sample samples.text.Strings.toUpperCase
*/
public actual fun String.toUpperCase(): String = TODO("Wasm stdlib: Text")
/**
* Returns a copy of this string converted to lower case using the rules of the default locale.
*
* @sample samples.text.Strings.toLowerCase
*/
public actual fun String.toLowerCase(): String = TODO("Wasm stdlib: Text")
public actual fun String.capitalize(): String = TODO("Wasm stdlib: Text")
public actual fun String.decapitalize(): String = TODO("Wasm stdlib: Text")
public actual fun CharSequence.repeat(n: Int): String = TODO("Wasm stdlib: Text")
/**
* Returns a new string with all occurrences of [oldChar] replaced with [newChar].
*/
actual fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boolean): String = TODO("Wasm stdlib: Text")
/**
* Returns a new string obtained by replacing all occurrences of the [oldValue] substring in this string
* with the specified [newValue] string.
*/
actual fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean): String = TODO("Wasm stdlib: Text")
/**
* Returns a new string with the first occurrence of [oldChar] replaced with [newChar].
*/
actual fun String.replaceFirst(oldChar: Char, newChar: Char, ignoreCase: Boolean): String = TODO("Wasm stdlib: Text")
/**
* Returns a new string obtained by replacing the first occurrence of the [oldValue] substring in this string
* with the specified [newValue] string.
*/
actual fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: Boolean): String = TODO("Wasm stdlib: Text")
/**
* Returns `true` if this string is equal to [other], optionally ignoring character case.
*
* @param ignoreCase `true` to ignore character case when comparing strings. By default `false`.
*/
actual fun String?.equals(other: String?, ignoreCase: Boolean): Boolean = TODO("Wasm stdlib: Text")
/**
* Compares two strings lexicographically, optionally ignoring case differences.
*/
@SinceKotlin("1.2")
actual fun String.compareTo(other: String, ignoreCase: Boolean): Int = TODO("Wasm stdlib: Text")
public actual fun String.startsWith(prefix: String, ignoreCase: Boolean): Boolean = TODO("Wasm stdlib: Text")
public actual fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolean): Boolean = TODO("Wasm stdlib: Text")
public actual fun String.endsWith(suffix: String, ignoreCase: Boolean): Boolean = TODO("Wasm stdlib: Text")
// From stringsCode.kt
internal actual fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int = TODO("Wasm stdlib: Text")
internal actual fun String.nativeLastIndexOf(ch: Char, fromIndex: Int): Int = TODO("Wasm stdlib: Text")
actual fun CharSequence.isBlank(): Boolean = TODO("Wasm stdlib: Text")
/**
* Returns `true` if the specified range in this char sequence is equal to the specified range in another char sequence.
* @param thisOffset the start offset in this char sequence of the substring to compare.
* @param other the string against a substring of which the comparison is performed.
* @param otherOffset the start offset in the other char sequence of the substring to compare.
* @param length the length of the substring to compare.
*/
actual fun CharSequence.regionMatches(
thisOffset: Int,
other: CharSequence,
otherOffset: Int,
length: Int,
ignoreCase: Boolean
): Boolean = TODO("Wasm stdlib: Text")
/**
* A Comparator that orders strings ignoring character case.
*
* Note that this Comparator does not take locale into account,
* and will result in an unsatisfactory ordering for certain locales.
*/
@SinceKotlin("1.2")
public actual val String.Companion.CASE_INSENSITIVE_ORDER: Comparator<String> get() = TODO("Wasm stdlib: Text")
actual fun String.toBoolean(): Boolean = TODO("Wasm stdlib: Text")
/**
* Returns `true` if the contents of this string is equal to the word "true", ignoring case, and `false` otherwise.
*/
actual fun String?.toBoolean(): Boolean = TODO("Wasm stdlib: Text")
/**
* Parses the string as a signed [Byte] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
actual fun String.toByte(): Byte = TODO("Wasm stdlib: Text")
/**
* Parses the string as a signed [Byte] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
* @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
*/
actual fun String.toByte(radix: Int): Byte = TODO("Wasm stdlib: Text")
/**
* Parses the string as a [Short] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
actual fun String.toShort(): Short = TODO("Wasm stdlib: Text")
/**
* Parses the string as a [Short] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
* @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
*/
actual fun String.toShort(radix: Int): Short = TODO("Wasm stdlib: Text")
/**
* Parses the string as an [Int] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
actual fun String.toInt(): Int = TODO("Wasm stdlib: Text")
/**
* Parses the string as an [Int] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
* @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
*/
actual fun String.toInt(radix: Int): Int = TODO("Wasm stdlib: Text")
/**
* Parses the string as a [Long] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
actual fun String.toLong(): Long = TODO("Wasm stdlib: Text")
/**
* Parses the string as a [Long] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
* @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
*/
actual fun String.toLong(radix: Int): Long = TODO("Wasm stdlib: Text")
/**
* Parses the string as a [Double] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
actual fun String.toDouble(): Double = TODO("Wasm stdlib: Text")
/**
* Parses the string as a [Float] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
actual fun String.toFloat(): Float = TODO("Wasm stdlib: Text")
/**
* Parses the string as a [Double] number and returns the result
* or `null` if the string is not a valid representation of a number.
*/
actual fun String.toDoubleOrNull(): Double? = TODO("Wasm stdlib: Text")
/**
* Parses the string as a [Float] number and returns the result
* or `null` if the string is not a valid representation of a number.
*/
actual fun String.toFloatOrNull(): Float? = TODO("Wasm stdlib: Text")
/**
* Returns a string representation of this [Byte] value in the specified [radix].
*
* @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
*/
@SinceKotlin("1.2")
actual fun Byte.toString(radix: Int): String = TODO("Wasm stdlib: Text")
/**
* Returns a string representation of this [Short] value in the specified [radix].
*
* @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
*/
@SinceKotlin("1.2")
actual fun Short.toString(radix: Int): String = TODO("Wasm stdlib: Text")
/**
* Returns a string representation of this [Int] value in the specified [radix].
*
* @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
*/
@SinceKotlin("1.2")
actual fun Int.toString(radix: Int): String = TODO("Wasm stdlib: Text")
/**
* Returns a string representation of this [Long] value in the specified [radix].
*
* @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
*/
@SinceKotlin("1.2")
actual fun Long.toString(radix: Int): String = TODO("Wasm stdlib: Text")
@PublishedApi
internal actual fun checkRadix(radix: Int): Int = TODO("Wasm stdlib: Text")
internal actual fun digitOf(char: Char, radix: Int): Int = TODO("Wasm stdlib: Text")
@@ -0,0 +1,32 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
/**
* Provides a skeletal implementation of the [MutableCollection] interface.
*
* @param E the type of elements contained in the collection. The collection is invariant on its element type.
*/
@SinceKotlin("1.3")
public actual abstract class AbstractMutableCollection<E> : MutableCollection<E> {
actual protected constructor()
actual abstract override val size: Int
actual abstract override fun iterator(): MutableIterator<E>
actual abstract override fun add(element: E): Boolean
actual override fun isEmpty(): Boolean = TODO("Wasm stdlib: AbstractMutableCollection")
actual override fun contains(element: @UnsafeVariance E): Boolean = TODO("Wasm stdlib: AbstractMutableCollection")
actual override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean = TODO("Wasm stdlib: AbstractMutableCollection")
actual override fun addAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: AbstractMutableCollection")
actual override fun remove(element: E): Boolean = TODO("Wasm stdlib: AbstractMutableCollection")
actual override fun removeAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: AbstractMutableCollection")
actual override fun retainAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: AbstractMutableCollection")
actual override fun clear(): Unit = TODO("Wasm stdlib: AbstractMutableCollection")
}
@@ -0,0 +1,45 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
/**
* Provides a skeletal implementation of the [MutableList] interface.
*
* @param E the type of elements contained in the list. The list is invariant on its element type.
*/
public actual abstract class AbstractMutableList<E> : MutableList<E> {
actual protected constructor()
// From List
actual override fun isEmpty(): Boolean = TODO("Wasm stdlib: AbstractMutableList")
actual override fun contains(element: @UnsafeVariance E): Boolean = TODO("Wasm stdlib: AbstractMutableList")
actual override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean = TODO("Wasm stdlib: AbstractMutableList")
actual override fun indexOf(element: @UnsafeVariance E): Int = TODO("Wasm stdlib: AbstractMutableList")
actual override fun lastIndexOf(element: @UnsafeVariance E): Int = TODO("Wasm stdlib: AbstractMutableList")
// From MutableCollection
actual override fun iterator(): MutableIterator<E> = TODO("Wasm stdlib: AbstractMutableList")
// From MutableList
/**
* Adds the specified element to the end of this list.
*
* @return `true` because the list is always modified as the result of this operation.
*/
actual override fun add(element: E): Boolean = TODO("Wasm stdlib: AbstractMutableList")
actual override fun remove(element: E): Boolean = TODO("Wasm stdlib: AbstractMutableList")
actual override fun addAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: AbstractMutableList")
actual override fun addAll(index: Int, elements: Collection<E>): Boolean = TODO("Wasm stdlib: AbstractMutableList")
actual override fun removeAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: AbstractMutableList")
actual override fun retainAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: AbstractMutableList")
actual override fun clear() { TODO("Wasm stdlib: AbstractMutableList") }
actual override fun listIterator(): MutableListIterator<E> = TODO("Wasm stdlib: AbstractMutableList")
actual override fun listIterator(index: Int): MutableListIterator<E> = TODO("Wasm stdlib: AbstractMutableList")
actual override fun subList(fromIndex: Int, toIndex: Int): MutableList<E> = TODO("Wasm stdlib: AbstractMutableList")
}
@@ -0,0 +1,42 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
/**
* Provides a skeletal implementation of the [MutableMap] interface.
*
* The implementor is required to implement [entries] property, which should return mutable set of map entries, and [put] function.
*
* @param K the type of map keys. The map is invariant on its key type.
* @param V the type of map values. The map is invariant on its value type.
*/
@SinceKotlin("1.3")
public actual abstract class AbstractMutableMap<K, V> : MutableMap<K, V> {
actual protected constructor()
/**
* Associates the specified [value] with the specified [key] in the map.
*
* This method is redeclared as abstract, because it's not implemented in the base class,
* so it must be always overridden in the concrete mutable collection implementation.
*
* @return the previous value associated with the key, or `null` if the key was not present in the map.
*/
abstract actual override fun put(key: K, value: V): V?
abstract actual override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
actual override val keys: MutableSet<K> = TODO("Wasm stdlib: AbstractMutableMap")
actual override val size: Int = TODO("Wasm stdlib: AbstractMutableMap")
actual override val values: MutableCollection<V> = TODO("Wasm stdlib: AbstractMutableMap")
actual override fun clear() { TODO("Wasm stdlib: AbstractMutableMap") }
actual override fun containsKey(key: K): Boolean = TODO("Wasm stdlib: AbstractMutableMap")
actual override fun containsValue(value: V): Boolean = TODO("Wasm stdlib: AbstractMutableMap")
actual override fun get(key: K): V? = TODO("Wasm stdlib: AbstractMutableMap")
actual override fun isEmpty(): Boolean = TODO("Wasm stdlib: AbstractMutableMap")
actual override fun putAll(from: Map<out K, V>) { TODO("Wasm stdlib: AbstractMutableMap") }
actual override fun remove(key: K): V? = TODO("Wasm stdlib: AbstractMutableMap")
}
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
/**
* Provides a skeletal implementation of the [MutableSet] interface.
*
* @param E the type of elements contained in the set. The set is invariant on its element type.
*/
@SinceKotlin("1.3")
public actual abstract class AbstractMutableSet<E> : MutableSet<E> {
actual protected constructor()
actual abstract override val size: Int
actual abstract override fun iterator(): MutableIterator<E>
actual abstract override fun add(element: E): Boolean
actual override fun isEmpty(): Boolean = TODO("Wasm stdlib: AbstractMutableSet")
actual override fun contains(element: @UnsafeVariance E): Boolean = TODO("Wasm stdlib: AbstractMutableSet")
actual override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean = TODO("Wasm stdlib: AbstractMutableSet")
actual override fun addAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: AbstractMutableSet")
actual override fun remove(element: E): Boolean = TODO("Wasm stdlib: AbstractMutableSet")
actual override fun removeAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: AbstractMutableSet")
actual override fun retainAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: AbstractMutableSet")
actual override fun clear() { TODO("Wasm stdlib: AbstractMutableSet") }
}
@@ -0,0 +1,45 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
actual open class ArrayList<E> : MutableList<E>, RandomAccess {
actual constructor() { TODO("Wasm stdlib: ArrayList") }
actual constructor(initialCapacity: Int) { TODO("Wasm stdlib: ArrayList") }
actual constructor(elements: Collection<E>) { TODO("Wasm stdlib: ArrayList") }
actual fun trimToSize() { TODO("Wasm stdlib: ArrayList") }
actual fun ensureCapacity(minCapacity: Int) { TODO("Wasm stdlib: ArrayList") }
// From List
actual override val size: Int = TODO("Wasm stdlib: ArrayList")
actual override fun isEmpty(): Boolean = TODO("Wasm stdlib: ArrayList")
actual override fun contains(element: @UnsafeVariance E): Boolean = TODO("Wasm stdlib: ArrayList")
actual override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean = TODO("Wasm stdlib: ArrayList")
actual override operator fun get(index: Int): E = TODO("Wasm stdlib: ArrayList")
actual override fun indexOf(element: @UnsafeVariance E): Int = TODO("Wasm stdlib: ArrayList")
actual override fun lastIndexOf(element: @UnsafeVariance E): Int = TODO("Wasm stdlib: ArrayList")
// From MutableCollection
actual override fun iterator(): MutableIterator<E> = TODO("Wasm stdlib: ArrayList")
// From MutableList
actual override fun add(element: E): Boolean = TODO("Wasm stdlib: ArrayList")
actual override fun remove(element: E): Boolean = TODO("Wasm stdlib: ArrayList")
actual override fun addAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: ArrayList")
actual override fun addAll(index: Int, elements: Collection<E>): Boolean = TODO("Wasm stdlib: ArrayList")
actual override fun removeAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: ArrayList")
actual override fun retainAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: ArrayList")
actual override fun clear() { TODO("Wasm stdlib: ArrayList") }
actual override operator fun set(index: Int, element: E): E = TODO("Wasm stdlib: ArrayList")
actual override fun add(index: Int, element: E) { TODO("Wasm stdlib: ArrayList") }
actual override fun removeAt(index: Int): E = TODO("Wasm stdlib: ArrayList")
actual override fun listIterator(): MutableListIterator<E> = TODO("Wasm stdlib: ArrayList")
actual override fun listIterator(index: Int): MutableListIterator<E> = TODO("Wasm stdlib: ArrayList")
actual override fun subList(fromIndex: Int, toIndex: Int): MutableList<E> = TODO("Wasm stdlib: ArrayList")
}
@@ -0,0 +1,105 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
import kotlin.internal.PureReifiable
// Array Utils copied from K/N
internal fun checkCopyOfRangeArguments(fromIndex: Int, toIndex: Int, size: Int) {
if (toIndex > size)
throw IndexOutOfBoundsException("toIndex ($toIndex) is greater than size ($size).")
if (fromIndex > toIndex)
throw IllegalArgumentException("fromIndex ($fromIndex) is greater than toIndex ($toIndex).")
}
// TODO: internal
/**
* Returns a string representation of the contents of the subarray of the specified array as if it is [List].
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public inline fun <T> Array<out T>.subarrayContentToString(offset: Int, length: Int): String {
val sb = StringBuilder(2 + length * 3)
sb.append("[")
var i = 0
while (i < length) {
if (i > 0) sb.append(", ")
sb.append(this[offset + i])
i++
}
sb.append("]")
return sb.toString()
}
/**
* Returns a hash code based on the contents of this array as if it is [List].
* Nested arrays are treated as lists too.
*
* If any of arrays contains itself on any nesting level the behavior is undefined.
*/
@SinceKotlin("1.1")
@UseExperimental(ExperimentalUnsignedTypes::class)
internal fun <T> Array<out T>?.contentDeepHashCodeImpl(): Int {
if (this == null) return 0
var result = 1
for (element in this) {
val elementHash = when (element) {
null -> 0
is Array<*> -> element.contentDeepHashCode()
is ByteArray -> element.contentHashCode()
is ShortArray -> element.contentHashCode()
is IntArray -> element.contentHashCode()
is LongArray -> element.contentHashCode()
is FloatArray -> element.contentHashCode()
is DoubleArray -> element.contentHashCode()
is CharArray -> element.contentHashCode()
is BooleanArray -> element.contentHashCode()
is UByteArray -> element.contentHashCode()
is UShortArray -> element.contentHashCode()
is UIntArray -> element.contentHashCode()
is ULongArray -> element.contentHashCode()
else -> element.hashCode()
}
result = 31 * result + elementHash
}
return result
}
@Suppress("UNCHECKED_CAST")
internal actual fun <T> arrayOfNulls(reference: Array<T>, size: Int): Array<T> = arrayOfNulls<Any>(size) as Array<T>
internal actual fun copyToArrayImpl(collection: Collection<*>): Array<Any?> {
val array = Array<Any?>(collection.size)
val iterator = collection.iterator()
var index = 0
while (iterator.hasNext())
array[index++] = iterator.next()
return array
}
@Suppress("UNCHECKED_CAST")
internal actual fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<T>): Array<T> {
if (array.size < collection.size)
return copyToArrayImpl(collection) as Array<T>
val iterator = collection.iterator()
var index = 0
while (iterator.hasNext()) {
array[index++] = iterator.next() as T
}
if (index < array.size) {
return array.copyOf(index) as Array<T>
}
return array
}
@@ -0,0 +1,111 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
actual interface RandomAccess
/** Returns the array if it's not `null`, or an empty array otherwise. */
actual inline fun <reified T> Array<out T>?.orEmpty(): Array<out T> = this ?: emptyArray<T>()
public actual inline fun <reified T> Collection<T>.toTypedArray(): Array<T> {
val result = arrayOfNulls<T>(size)
var index = 0
for (element in this) result[index++] = element
@Suppress("UNCHECKED_CAST")
return result as Array<T>
}
@SinceKotlin("1.2")
actual fun <T> MutableList<T>.fill(value: T): Unit = TODO("Wasm stdlib: Collections")
@SinceKotlin("1.2")
actual fun <T> MutableList<T>.shuffle(): Unit = TODO("Wasm stdlib: Collections")
@SinceKotlin("1.2")
actual fun <T> Iterable<T>.shuffled(): List<T> = TODO("Wasm stdlib: Collections")
actual fun <T : Comparable<T>> MutableList<T>.sort(): Unit = TODO("Wasm stdlib: Collections")
actual fun <T> MutableList<T>.sortWith(comparator: Comparator<in T>): Unit = TODO("Wasm stdlib: Collections")
// from Grouping.kt
public actual fun <T, K> Grouping<T, K>.eachCount(): Map<K, Int> = TODO("Wasm stdlib: Collections")
// public actual inline fun <T, K> Grouping<T, K>.eachSumOf(valueSelector: (T) -> Int): Map<K, Int>
internal actual fun <K, V> Map<K, V>.toSingletonMapOrSelf(): Map<K, V> = TODO("Wasm stdlib: Collections")
internal actual fun <K, V> Map<out K, V>.toSingletonMap(): Map<K, V> = TODO("Wasm stdlib: Collections")
internal actual fun <T> Array<out T>.copyToArrayOfAny(isVarargs: Boolean): Array<out Any?> = TODO("Wasm stdlib: Collections")
@PublishedApi
@SinceKotlin("1.3")
internal actual fun checkIndexOverflow(index: Int): Int = TODO("Wasm stdlib: Collections")
@PublishedApi
@SinceKotlin("1.3")
internal actual fun checkCountOverflow(count: Int): Int = TODO("Wasm stdlib: Collections")
@PublishedApi
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@kotlin.internal.InlineOnly
internal actual inline fun <E> buildListInternal(builderAction: MutableList<E>.() -> Unit): List<E> {
return TODO("Wasm stdlib: Collections")
}
@PublishedApi
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@kotlin.internal.InlineOnly
internal actual inline fun <E> buildListInternal(capacity: Int, builderAction: MutableList<E>.() -> Unit): List<E> {
checkBuilderCapacity(capacity)
return TODO("Wasm stdlib: Collections")
}
/**
* Returns an immutable set containing only the specified object [element].
*/
public fun <T> setOf(element: T): Set<T> = hashSetOf(element)
@PublishedApi
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@kotlin.internal.InlineOnly
internal actual inline fun <E> buildSetInternal(builderAction: MutableSet<E>.() -> Unit): Set<E> {
return TODO("Wasm stdlib: Collections")
}
@PublishedApi
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@kotlin.internal.InlineOnly
internal actual inline fun <E> buildSetInternal(capacity: Int, builderAction: MutableSet<E>.() -> Unit): Set<E> {
return TODO("Wasm stdlib: Collections")
}
/**
* Returns an immutable map, mapping only the specified key to the
* specified value.
*/
public fun <K, V> mapOf(pair: Pair<K, V>): Map<K, V> = hashMapOf(pair)
@PublishedApi
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@kotlin.internal.InlineOnly
internal actual inline fun <K, V> buildMapInternal(builderAction: MutableMap<K, V>.() -> Unit): Map<K, V> {
return TODO("Wasm stdlib: Collections")
}
@PublishedApi
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@kotlin.internal.InlineOnly
internal actual inline fun <K, V> buildMapInternal(capacity: Int, builderAction: MutableMap<K, V>.() -> Unit): Map<K, V> {
return TODO("Wasm stdlib: Collections")
}
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
actual open class HashMap<K, V> : MutableMap<K, V> {
actual constructor() { TODO("Wasm stdlib: HashMap") }
actual constructor(initialCapacity: Int) { TODO("Wasm stdlib: HashMap") }
actual constructor(initialCapacity: Int, loadFactor: Float) { TODO("Wasm stdlib: HashMap") }
actual constructor(original: Map<out K, V>) { TODO("Wasm stdlib: HashMap") }
// From Map
actual override val size: Int = TODO("Wasm stdlib: HashMap")
actual override fun isEmpty(): Boolean = TODO("Wasm stdlib: HashMap")
actual override fun containsKey(key: K): Boolean = TODO("Wasm stdlib: HashMap")
actual override fun containsValue(value: @UnsafeVariance V): Boolean = TODO("Wasm stdlib: HashMap")
actual override operator fun get(key: K): V? = TODO("Wasm stdlib: HashMap")
// From MutableMap
actual override fun put(key: K, value: V): V? = TODO("Wasm stdlib: HashMap")
actual override fun remove(key: K): V? = TODO("Wasm stdlib: HashMap")
actual override fun putAll(from: Map<out K, V>) { TODO("Wasm stdlib: HashMap") }
actual override fun clear() { TODO("Wasm stdlib: HashMap") }
actual override val keys: MutableSet<K> = TODO("Wasm stdlib: HashMap")
actual override val values: MutableCollection<V> = TODO("Wasm stdlib: HashMap")
actual override val entries: MutableSet<MutableMap.MutableEntry<K, V>> = TODO("Wasm stdlib: HashMap")
}
@@ -0,0 +1,30 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
actual open class HashSet<E> : MutableSet<E> {
actual constructor() { TODO("Wasm stdlib: HashSet") }
actual constructor(initialCapacity: Int) { TODO("Wasm stdlib: HashSet") }
actual constructor(initialCapacity: Int, loadFactor: Float) { TODO("Wasm stdlib: HashSet") }
actual constructor(elements: Collection<E>) { TODO("Wasm stdlib: HashSet") }
// From Set
actual override val size: Int = TODO("Wasm stdlib: HashSet")
actual override fun isEmpty(): Boolean = TODO("Wasm stdlib: HashSet")
actual override fun contains(element: @UnsafeVariance E): Boolean = TODO("Wasm stdlib: HashSet")
actual override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean = TODO("Wasm stdlib: HashSet")
// From MutableSet
actual override fun iterator(): MutableIterator<E> = TODO("Wasm stdlib: HashSet")
actual override fun add(element: E): Boolean = TODO("Wasm stdlib: HashSet")
actual override fun remove(element: E): Boolean = TODO("Wasm stdlib: HashSet")
actual override fun addAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: HashSet")
actual override fun removeAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: HashSet")
actual override fun retainAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: HashSet")
actual override fun clear() { TODO("Wasm stdlib: HashSet") }
}
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
actual open class LinkedHashMap<K, V> : MutableMap<K, V> {
actual constructor() { TODO("Wasm stdlib: LinkedHashMap") }
actual constructor(initialCapacity: Int) { TODO("Wasm stdlib: LinkedHashMap") }
actual constructor(initialCapacity: Int, loadFactor: Float) { TODO("Wasm stdlib: LinkedHashMap") }
actual constructor(original: Map<out K, V>) { TODO("Wasm stdlib: LinkedHashMap") }
// From Map
actual override val size: Int = TODO("Wasm stdlib: LinkedHashMap")
actual override fun isEmpty(): Boolean = TODO("Wasm stdlib: LinkedHashMap")
actual override fun containsKey(key: K): Boolean = TODO("Wasm stdlib: LinkedHashMap")
actual override fun containsValue(value: V): Boolean = TODO("Wasm stdlib: LinkedHashMap")
actual override fun get(key: K): V? = TODO("Wasm stdlib: LinkedHashMap")
// From MutableMap
actual override fun put(key: K, value: V): V? = TODO("Wasm stdlib: LinkedHashMap")
actual override fun remove(key: K): V? = TODO("Wasm stdlib: LinkedHashMap")
actual override fun putAll(from: Map<out K, V>) { TODO("Wasm stdlib: LinkedHashMap") }
actual override fun clear() { TODO("Wasm stdlib: LinkedHashMap") }
actual override val keys: MutableSet<K> = TODO("Wasm stdlib: LinkedHashMap")
actual override val values: MutableCollection<V> = TODO("Wasm stdlib: LinkedHashMap")
actual override val entries: MutableSet<MutableMap.MutableEntry<K, V>> = TODO("Wasm stdlib: LinkedHashMap")
}
@@ -0,0 +1,30 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
actual open class LinkedHashSet<E> : MutableSet<E> {
actual constructor() { TODO("Wasm stdlib: LinkedHashSet") }
actual constructor(initialCapacity: Int) { TODO("Wasm stdlib: LinkedHashSet") }
actual constructor(initialCapacity: Int, loadFactor: Float) { TODO("Wasm stdlib: LinkedHashSet") }
actual constructor(elements: Collection<E>) { TODO("Wasm stdlib: LinkedHashSet") }
// From Set
actual override val size: Int = TODO("Wasm stdlib: LinkedHashSet")
actual override fun isEmpty(): Boolean = TODO("Wasm stdlib: LinkedHashSet")
actual override fun contains(element: @UnsafeVariance E): Boolean = TODO("Wasm stdlib: LinkedHashSet")
actual override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean = TODO("Wasm stdlib: LinkedHashSet")
// From MutableSet
actual override fun iterator(): MutableIterator<E> = TODO("Wasm stdlib: LinkedHashSet")
actual override fun add(element: E): Boolean = TODO("Wasm stdlib: LinkedHashSet")
actual override fun remove(element: E): Boolean = TODO("Wasm stdlib: LinkedHashSet")
actual override fun addAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: LinkedHashSet")
actual override fun removeAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: LinkedHashSet")
actual override fun retainAll(elements: Collection<E>): Boolean = TODO("Wasm stdlib: LinkedHashSet")
actual override fun clear() { TODO("Wasm stdlib: LinkedHashSet") }
}
@@ -0,0 +1,20 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
/**
* Calculate the initial capacity of a map.
*/
@PublishedApi
internal actual fun mapCapacity(expectedSize: Int): Int = TODO("Wasm stdlib: Maps")
/**
* Checks a collection builder function capacity argument.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@PublishedApi
internal fun checkBuilderCapacity(capacity: Int) { TODO("Wasm stdlib: Maps") }
@@ -0,0 +1,21 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.coroutines
@PublishedApi
@SinceKotlin("1.3")
internal actual class SafeContinuation<in T> : Continuation<T> {
actual internal constructor(delegate: Continuation<T>, initialResult: Any?) { TODO("Wasm stdlib: Coroutines") }
@PublishedApi
actual internal constructor(delegate: Continuation<T>) { TODO("Wasm stdlib: Coroutines") }
@PublishedApi
actual internal fun getOrThrow(): Any? = TODO("Wasm stdlib: Coroutines")
actual override val context: CoroutineContext = TODO("Wasm stdlib: Coroutines")
actual override fun resumeWith(result: Result<T>): Unit { TODO("Wasm stdlib: Coroutines") }
}
@@ -0,0 +1,76 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.coroutines.intrinsics
import kotlin.coroutines.Continuation
import kotlin.coroutines.ContinuationInterceptor
import kotlin.coroutines.CoroutineContext
import kotlin.internal.InlineOnly
/**
* Starts an unintercepted coroutine without a receiver and with result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the latter case, the [completion] continuation is invoked when the coroutine completes with a result or an exception.
*
* The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
* be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
* context is established.
*
* This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of the suspended
* coroutine using a reference to the suspending function.
*/
@SinceKotlin("1.3")
public actual inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrReturn(
completion: Continuation<T>
): Any? = TODO("Wasm stdlib: Coroutines intrinsics")
/**
* Starts an unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension.
* Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
* In the latter case, the [completion] continuation is invoked when the coroutine completes with a result or an exception.
*
* The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
* be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
* context is established.
*
* This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of the suspended
* coroutine using a reference to the suspending function.
*/
@SinceKotlin("1.3")
public actual inline fun <R, T> (suspend R.() -> T).startCoroutineUninterceptedOrReturn(
receiver: R,
completion: Continuation<T>
): Any? = TODO("Wasm stdlib: Coroutines intrinsics")
@InlineOnly
internal actual inline fun <R, P, T> (suspend R.(P) -> T).startCoroutineUninterceptedOrReturn(
receiver: R,
param: P,
completion: Continuation<T>
): Any? = TODO("Wasm stdlib: Coroutines intrinsics")
@SinceKotlin("1.3")
public actual fun <T> (suspend () -> T).createCoroutineUnintercepted(
completion: Continuation<T>
): Continuation<Unit> = TODO("Wasm stdlib: Coroutines intrinsics")
@SinceKotlin("1.3")
public actual fun <R, T> (suspend R.() -> T).createCoroutineUnintercepted(
receiver: R,
completion: Continuation<T>
): Continuation<Unit> = TODO("Wasm stdlib: Coroutines intrinsics")
/**
* Intercepts this continuation with [ContinuationInterceptor].
*
* This function shall be used on the immediate result of [createCoroutineUnintercepted] or [suspendCoroutineUninterceptedOrReturn],
* in which case it checks for [ContinuationInterceptor] in the continuation's [context][Continuation.context],
* invokes [ContinuationInterceptor.interceptContinuation], caches and returns the result.
*
* If this function is invoked on other [Continuation] instances it returns `this` continuation unchanged.
*/
@SinceKotlin("1.3")
public actual fun <T> Continuation<T>.intercepted(): Continuation<T> = TODO("Wasm stdlib: Coroutines intrinsics")
@@ -0,0 +1,15 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.coroutines.cancellation
@ExperimentalStdlibApi
@SinceKotlin("1.4")
public actual open class CancellationException : IllegalStateException {
actual constructor() : super()
actual constructor(message: String?) : super(message)
constructor(message: String?, cause: Throwable?) : super(message, cause)
constructor(cause: Throwable?) : super(cause)
}
+31
View File
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.io
import kotlin.wasm.internal.*
/** Prints the line separator to the standard output stream. */
public actual fun println() {
println("")
}
/** Prints the given [message] and the line separator to the standard output stream. */
public actual fun println(message: Any?) {
printlnImpl(message.toString())
}
/** Prints the given [message] to the standard output stream. */
public actual fun print(message: Any?) {
// TODO: Support print without newline
println(message)
}
internal actual interface Serializable
@WasmImport("runtime", "println")
private fun printlnImpl(message: String): Unit =
implementedAsIntrinsic
@@ -0,0 +1,9 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.random
internal actual fun defaultPlatformRandom(): Random = TODO("Wasm stdlib: Random")
internal actual fun doubleFromParts(hi26: Int, low27: Int): Double = TODO("Wasm stdlib: Random")
@@ -0,0 +1,23 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.reflect
/**
* Represents a callable entity, such as a function or a property.
*
* @param R return type of the callable.
*/
public actual interface KCallable<out R> {
/**
* The name of this callable as it was declared in the source code.
* If the callable has no name, a special invented name is created.
* Nameless callables include:
* - constructors have the name "<init>",
* - property accessors: the getter for a property named "foo" will have the name "<get-foo>",
* the setter, similarly, will have the name "<set-foo>".
*/
actual public val name: String
}
@@ -0,0 +1,35 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.reflect
/**
* Represents a class and provides introspection capabilities.
* Instances of this class are obtainable by the `::class` syntax.
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/reflection.html#class-references)
* for more information.
*
* @param T the type of the class.
*/
public actual interface KClass<T : Any> : KClassifier {
/**
* The simple name of the class as it was declared in the source code,
* or `null` if the class has no name (if, for example, it is a class of an anonymous object).
*/
public actual val simpleName: String?
/**
* The fully qualified dot-separated name of the class,
* or `null` if the class is local or a class of an anonymous object.
*/
public actual val qualifiedName: String?
/**
* Returns `true` if [value] is an instance of this class on a given platform.
*/
@SinceKotlin("1.1")
public actual fun isInstance(value: Any?): Boolean
}
@@ -0,0 +1,8 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.reflect
internal actual val KClass<*>.qualifiedOrSimpleName: String? get() = TODO("Wasm stdlib: KClass<*>.qualifiedOrSimpleName")
@@ -0,0 +1,11 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.reflect
/**
* Represents a function with introspection capabilities.
*/
public actual interface KFunction<out R> : KCallable<R>, Function<R>
@@ -0,0 +1,119 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("IMPLEMENTING_FUNCTION_INTERFACE")
package kotlin.reflect
/**
* Represents a property, such as a named `val` or `var` declaration.
* Instances of this class are obtainable by the `::` operator.
*
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/reflection.html)
* for more information.
*
* @param R the type of the property.
*/
public actual interface KProperty<out R> : KCallable<R> {
}
/**
* Represents a property declared as a `var`.
*/
public actual interface KMutableProperty<R> : KProperty<R> {
}
/**
* Represents a property without any kind of receiver.
* Such property is either originally declared in a receiverless context such as a package,
* or has the receiver bound to it.
*/
public actual interface KProperty0<out R> : KProperty<R>, () -> R {
/**
* Returns the current value of the property.
*/
public actual fun get(): R
}
/**
* Represents a `var`-property without any kind of receiver.
*/
public actual interface KMutableProperty0<R> : KProperty0<R>, KMutableProperty<R> {
/**
* Modifies the value of the property.
*
* @param value the new value to be assigned to this property.
*/
public actual fun set(value: R)
}
/**
* Represents a property, operations on which take one receiver as a parameter.
*
* @param T the type of the receiver which should be used to obtain the value of the property.
* @param R the type of the property.
*/
public actual interface KProperty1<T, out R> : KProperty<R>, (T) -> R {
/**
* Returns the current value of the property.
*
* @param receiver the receiver which is used to obtain the value of the property.
* For example, it should be a class instance if this is a member property of that class,
* or an extension receiver if this is a top level extension property.
*/
public actual fun get(receiver: T): R
}
/**
* Represents a `var`-property, operations on which take one receiver as a parameter.
*/
public actual interface KMutableProperty1<T, R> : KProperty1<T, R>, KMutableProperty<R> {
/**
* Modifies the value of the property.
*
* @param receiver the receiver which is used to modify the value of the property.
* For example, it should be a class instance if this is a member property of that class,
* or an extension receiver if this is a top level extension property.
* @param value the new value to be assigned to this property.
*/
public actual fun set(receiver: T, value: R)
}
/**
* Represents a property, operations on which take two receivers as parameters,
* such as an extension property declared in a class.
*
* @param D the type of the first receiver. In case of the extension property in a class this is
* the type of the declaring class of the property, or any subclass of that class.
* @param E the type of the second receiver. In case of the extension property in a class this is
* the type of the extension receiver.
* @param R the type of the property.
*/
public actual interface KProperty2<D, E, out R> : KProperty<R>, (D, E) -> R {
/**
* Returns the current value of the property. In case of the extension property in a class,
* the instance of the class should be passed first and the instance of the extension receiver second.
*
* @param receiver1 the instance of the first receiver.
* @param receiver2 the instance of the second receiver.
*/
public actual fun get(receiver1: D, receiver2: E): R
}
/**
* Represents a `var`-property, operations on which take two receivers as parameters.
*/
public actual interface KMutableProperty2<D, E, R> : KProperty2<D, E, R>, KMutableProperty<R> {
/**
* Modifies the value of the property.
*
* @param receiver1 the instance of the first receiver.
* @param receiver2 the instance of the second receiver.
* @param value the new value to be assigned to this property.
*/
public actual fun set(receiver1: D, receiver2: E, value: R)
}
@@ -0,0 +1,51 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.reflect
/**
* Represents a type. Type is usually either a class with optional type arguments,
* or a type parameter of some declaration, plus nullability.
*/
public actual interface KType {
/**
* The declaration of the classifier used in this type.
* For example, in the type `List<String>` the classifier would be the [KClass] instance for [List].
*
* Returns `null` if this type is not denotable in Kotlin, for example if it is an intersection type.
*/
@SinceKotlin("1.1")
public actual val classifier: KClassifier?
/**
* Type arguments passed for the parameters of the classifier in this type.
* For example, in the type `Array<out Number>` the only type argument is `out Number`.
*
* In case this type is based on an inner class, the returned list contains the type arguments provided for the innermost class first,
* then its outer class, and so on.
* For example, in the type `Outer<A, B>.Inner<C, D>` the returned list is `[C, D, A, B]`.
*/
@SinceKotlin("1.1")
public actual val arguments: List<KTypeProjection>
/**
* `true` if this type was marked nullable in the source code.
*
* For Kotlin types, it means that `null` value is allowed to be represented by this type.
* In practice it means that the type was declared with a question mark at the end.
* For non-Kotlin types, it means the type or the symbol which was declared with this type
* is annotated with a runtime-retained nullability annotation such as [javax.annotation.Nullable].
*
* Note that even if [isMarkedNullable] is false, values of the type can still be `null`.
* This may happen if it is a type of the type parameter with a nullable upper bound:
*
* ```
* fun <T> foo(t: T) {
* // isMarkedNullable == false for t's type, but t can be null here when T = "Any?"
* }
* ```
*/
public actual val isMarkedNullable: Boolean
}
@@ -0,0 +1,37 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.text
/**
* An object to which char sequences and values can be appended.
*/
actual interface Appendable {
/**
* Appends the specified character [value] to this Appendable and returns this instance.
*
* @param value the character to append.
*/
actual fun append(value: Char): Appendable
/**
* Appends the specified character sequence [value] to this Appendable and returns this instance.
*
* @param value the character sequence to append. If [value] is `null`, then the four characters `"null"` are appended to this Appendable.
*/
actual fun append(value: CharSequence?): Appendable
/**
* Appends a subsequence of the specified character sequence [value] to this Appendable and returns this instance.
*
* @param value the character sequence from which a subsequence is appended. If [value] is `null`,
* then characters are appended as if [value] contained the four characters `"null"`.
* @param startIndex the beginning (inclusive) of the subsequence to append.
* @param endIndex the end (exclusive) of the subsequence to append.
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.
*/
actual fun append(value: CharSequence?, startIndex: Int, endIndex: Int): Appendable
}
@@ -0,0 +1,13 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.text
/**
* The exception thrown when a character encoding or decoding error occurs.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual open class CharacterCodingException actual constructor() : Exception()
@@ -0,0 +1,387 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.text
/**
* A mutable sequence of characters.
*
* String builder can be used to efficiently perform multiple string manipulation operations.
*/
actual class StringBuilder : Appendable, CharSequence {
/** Constructs an empty string builder. */
actual constructor() { TODO("Wasm stdlib: StringBuilder") }
/** Constructs an empty string builder with the specified initial [capacity]. */
actual constructor(capacity: Int) { TODO("Wasm stdlib: StringBuilder") }
/** Constructs a string builder that contains the same characters as the specified [content] char sequence. */
actual constructor(content: CharSequence) { TODO("Wasm stdlib: StringBuilder") }
/** Constructs a string builder that contains the same characters as the specified [content] string. */
@SinceKotlin("1.3")
// @ExperimentalStdlibApi
actual constructor(content: String) { TODO("Wasm stdlib: StringBuilder") }
actual override val length: Int = TODO("Wasm stdlib: StringBuilder")
actual override operator fun get(index: Int): Char = TODO("Wasm stdlib: StringBuilder")
actual override fun subSequence(startIndex: Int, endIndex: Int): CharSequence = TODO("Wasm stdlib: StringBuilder")
actual override fun append(value: Char): StringBuilder = TODO("Wasm stdlib: StringBuilder")
actual override fun append(value: CharSequence?): StringBuilder = TODO("Wasm stdlib: StringBuilder")
actual override fun append(value: CharSequence?, startIndex: Int, endIndex: Int): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Reverses the contents of this string builder and returns this instance.
*
* Surrogate pairs included in this string builder are treated as single characters.
* Therefore, the order of the high-low surrogates is never reversed.
*
* Note that the reverse operation may produce new surrogate pairs that were unpaired low-surrogates and high-surrogates before the operation.
* For example, reversing `"\uDC00\uD800"` produces `"\uD800\uDC00"` which is a valid surrogate pair.
*/
actual fun reverse(): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Appends the string representation of the specified object [value] to this string builder and returns this instance.
*
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
actual fun append(value: Any?): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Appends the string representation of the specified boolean [value] to this string builder and returns this instance.
*
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was appended to this string builder.
*/
@SinceKotlin("1.3")
// @ExperimentalStdlibApi
actual fun append(value: Boolean): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Appends characters in the specified character array [value] to this string builder and returns this instance.
*
* Characters are appended in order, starting at the index 0.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun append(value: CharArray): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Appends the specified string [value] to this string builder and returns this instance.
*/
@SinceKotlin("1.3")
// @ExperimentalStdlibApi
actual fun append(value: String?): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Returns the current capacity of this string builder.
*
* The capacity is the maximum length this string builder can have before an allocation occurs.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun capacity(): Int = TODO("Wasm stdlib: StringBuilder")
/**
* Ensures that the capacity of this string builder is at least equal to the specified [minimumCapacity].
*
* If the current capacity is less than the [minimumCapacity], a new backing storage is allocated with greater capacity.
* Otherwise, this method takes no action and simply returns.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun ensureCapacity(minimumCapacity: Int) { TODO("Wasm stdlib: StringBuilder") }
/**
* Returns the index within this string builder of the first occurrence of the specified [string].
*
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun indexOf(string: String): Int = TODO("Wasm stdlib: StringBuilder")
/**
* Returns the index within this string builder of the first occurrence of the specified [string],
* starting at the specified [startIndex].
*
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun indexOf(string: String, startIndex: Int): Int = TODO("Wasm stdlib: StringBuilder")
/**
* Returns the index within this string builder of the last occurrence of the specified [string].
* The last occurrence of empty string `""` is considered to be at the index equal to `this.length`.
*
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun lastIndexOf(string: String): Int = TODO("Wasm stdlib: StringBuilder")
/**
* Returns the index within this string builder of the last occurrence of the specified [string],
* starting from the specified [startIndex] toward the beginning.
*
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun lastIndexOf(string: String, startIndex: Int): Int = TODO("Wasm stdlib: StringBuilder")
/**
* Inserts the string representation of the specified boolean [value] into this string builder at the specified [index] and returns this instance.
*
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was inserted into this string builder at the specified [index].
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun insert(index: Int, value: Boolean): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Inserts the specified character [value] into this string builder at the specified [index] and returns this instance.
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun insert(index: Int, value: Char): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Inserts characters in the specified character array [value] into this string builder at the specified [index] and returns this instance.
*
* The inserted characters go in same order as in the [value] character array, starting at [index].
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun insert(index: Int, value: CharArray): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Inserts characters in the specified character sequence [value] into this string builder at the specified [index] and returns this instance.
*
* The inserted characters go in the same order as in the [value] character sequence, starting at [index].
*
* @param index the position in this string builder to insert at.
* @param value the character sequence from which characters are inserted. If [value] is `null`, then the four characters `"null"` are inserted.
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun insert(index: Int, value: CharSequence?): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Inserts the string representation of the specified object [value] into this string builder at the specified [index] and returns this instance.
*
* The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
* and then that string was inserted into this string builder at the specified [index].
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun insert(index: Int, value: Any?): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Inserts the string [value] into this string builder at the specified [index] and returns this instance.
*
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun insert(index: Int, value: String?): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Sets the length of this string builder to the specified [newLength].
*
* If the [newLength] is less than the current length, it is changed to the specified [newLength].
* Otherwise, null characters '\u0000' are appended to this string builder until its length is less than the [newLength].
*
* Note that in Kotlin/JS [set] operator function has non-constant execution time complexity.
* Therefore, increasing length of this string builder and then updating each character by index may slow down your program.
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] if [newLength] is less than zero.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun setLength(newLength: Int) { TODO("Wasm stdlib: StringBuilder") }
/**
* Returns a new [String] that contains characters in this string builder at [startIndex] (inclusive) and up to the [length] (exclusive).
*
* @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun substring(startIndex: Int): String = TODO("Wasm stdlib: StringBuilder")
/**
* Returns a new [String] that contains characters in this string builder at [startIndex] (inclusive) and up to the [endIndex] (exclusive).
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun substring(startIndex: Int, endIndex: Int): String = TODO("Wasm stdlib: StringBuilder")
/**
* Attempts to reduce storage used for this string builder.
*
* If the backing storage of this string builder is larger than necessary to hold its current contents,
* then it may be resized to become more space efficient.
* Calling this method may, but is not required to, affect the value of the [capacity] property.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
actual fun trimToSize() { TODO("Wasm stdlib: StringBuilder") }
}
/**
* Clears the content of this string builder making it empty and returns this instance.
*
* @sample samples.text.Strings.clearStringBuilder
*/
@SinceKotlin("1.3")
public actual fun StringBuilder.clear(): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Sets the character at the specified [index] to the specified [value].
*
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual operator fun StringBuilder.set(index: Int, value: Char) { TODO("Wasm stdlib: StringBuilder") }
/**
* Replaces characters in the specified range of this string builder with characters in the specified string [value] and returns this instance.
*
* @param startIndex the beginning (inclusive) of the range to replace.
* @param endIndex the end (exclusive) of the range to replace.
* @param value the string to replace with.
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] if [startIndex] is less than zero, greater than the length of this string builder, or `startIndex > endIndex`.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun StringBuilder.setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Removes the character at the specified [index] from this string builder and returns this instance.
*
* If the `Char` at the specified [index] is part of a supplementary code point, this method does not remove the entire supplementary character.
*
* @param index the index of `Char` to remove.
*
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun StringBuilder.deleteAt(index: Int): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Removes characters in the specified range from this string builder and returns this instance.
*
* @param startIndex the beginning (inclusive) of the range to remove.
* @param endIndex the end (exclusive) of the range to remove.
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun StringBuilder.deleteRange(startIndex: Int, endIndex: Int): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Copies characters from this string builder into the [destination] character array.
*
* @param destination the array to copy to.
* @param destinationOffset the position in the array to copy to, 0 by default.
* @param startIndex the beginning (inclusive) of the range to copy, 0 by default.
* @param endIndex the end (exclusive) of the range to copy, length of this string builder by default.
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
* @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],
* or when that index is out of the [destination] array indices range.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int, startIndex: Int, endIndex: Int) { TODO("Wasm stdlib: StringBuilder") }
/**
* Appends characters in a subarray of the specified character array [value] to this string builder and returns this instance.
*
* Characters are appended in order, starting at specified [startIndex].
*
* @param value the array from which characters are appended.
* @param startIndex the beginning (inclusive) of the subarray to append.
* @param endIndex the end (exclusive) of the subarray to append.
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun StringBuilder.appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Appends a subsequence of the specified character sequence [value] to this string builder and returns this instance.
*
* @param value the character sequence from which a subsequence is appended. If [value] is `null`,
* then characters are appended as if [value] contained the four characters `"null"`.
* @param startIndex the beginning (inclusive) of the subsequence to append.
* @param endIndex the end (exclusive) of the subsequence to append.
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun StringBuilder.appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Inserts characters in a subarray of the specified character array [value] into this string builder at the specified [index] and returns this instance.
*
* The inserted characters go in same order as in the [value] array, starting at [index].
*
* @param index the position in this string builder to insert at.
* @param value the array from which characters are inserted.
* @param startIndex the beginning (inclusive) of the subarray to insert.
* @param endIndex the end (exclusive) of the subarray to insert.
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun StringBuilder.insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder = TODO("Wasm stdlib: StringBuilder")
/**
* Inserts characters in a subsequence of the specified character sequence [value] into this string builder at the specified [index] and returns this instance.
*
* The inserted characters go in the same order as in the [value] character sequence, starting at [index].
*
* @param index the position in this string builder to insert at.
* @param value the character sequence from which a subsequence is inserted. If [value] is `null`,
* then characters will be inserted as if [value] contained the four characters `"null"`.
* @param startIndex the beginning (inclusive) of the subsequence to insert.
* @param endIndex the end (exclusive) of the subsequence to insert.
*
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun StringBuilder.insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder = TODO("Wasm stdlib: StringBuilder")
@@ -0,0 +1,45 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin
/**
* Returns the detailed description of this throwable with its stack trace.
*
* The detailed description includes:
* - the short description (see [Throwable.toString]) of this throwable;
* - the complete stack trace;
* - detailed descriptions of the exceptions that were [suppressed][suppressedExceptions] in order to deliver this exception;
* - the detailed description of each throwable in the [Throwable.cause] chain.
*/
@SinceKotlin("1.4")
public actual fun Throwable.stackTraceToString(): String =
TODO("Implement stackTraceToString")
/**
* Prints the [detailed description][Throwable.stackTraceToString] of this throwable to console error output.
*/
@SinceKotlin("1.4")
public actual fun Throwable.printStackTrace() {
TODO("Implement printStackTrace")
}
/**
* Adds the specified exception to the list of exceptions that were
* suppressed in order to deliver this exception.
*/
@SinceKotlin("1.4")
public actual fun Throwable.addSuppressed(exception: Throwable) {
TODO("Implement Throwable.addSuppressed")
}
/**
* Returns a list of all exceptions that were suppressed in order to deliver this exception.
*/
@SinceKotlin("1.4")
public actual val Throwable.suppressedExceptions: List<Throwable>
get() {
TODO("Implement Throwable.suppressedExceptions")
}
@@ -0,0 +1,9 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.time
internal actual fun formatToExactDecimals(value: Double, decimals: Int): String = TODO("Wasm stdlib: Duration")
internal actual fun formatUpToDecimals(value: Double, decimals: Int): String = TODO("Wasm stdlib: Duration")
internal actual fun formatScientific(value: Double): String = TODO("Wasm stdlib: Duration")
@@ -0,0 +1,50 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.time
/**
* The list of possible time measurement units, in which a duration can be expressed.
*
* The smallest time unit is [NANOSECONDS] and the largest is [DAYS], which corresponds to exactly 24 [HOURS].
*/
@SinceKotlin("1.3")
@ExperimentalTime
public actual enum class DurationUnit {
/**
* Time unit representing one nanosecond, which is 1/1000 of a microsecond.
*/
NANOSECONDS,
/**
* Time unit representing one microsecond, which is 1/1000 of a millisecond.
*/
MICROSECONDS,
/**
* Time unit representing one millisecond, which is 1/1000 of a second.
*/
MILLISECONDS,
/**
* Time unit representing one second.
*/
SECONDS,
/**
* Time unit representing one minute.
*/
MINUTES,
/**
* Time unit representing one hour.
*/
HOURS,
/**
* Time unit representing one day, which is always equal to 24 hours.
*/
DAYS;
}
/** Converts the given time duration [value] expressed in the specified [sourceUnit] into the specified [targetUnit]. */
@SinceKotlin("1.3")
@ExperimentalTime
internal actual fun convertDurationUnit(value: Double, sourceUnit: DurationUnit, targetUnit: DurationUnit): Double = TODO("Wasm stdlib: convertDurationUnit")
@@ -0,0 +1,11 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.time
@SinceKotlin("1.3")
@ExperimentalTime
internal actual object MonotonicTimeSource : TimeSource {
override fun markNow(): TimeMark = TODO("Wasm stdlib: MonotonicTimeSource::markNow")
}
@@ -0,0 +1,138 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin
/**
* Counts the number of set bits in the binary representation of this [Int] number.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Int.countOneBits(): Int = TODO("Wasm stdlib: Numbers")
/**
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Int] number.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Int.countLeadingZeroBits(): Int = TODO("Wasm stdlib: Numbers")
/**
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Int] number.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Int.countTrailingZeroBits(): Int = TODO("Wasm stdlib: Numbers")
/**
* Returns a number having a single bit set in the position of the most significant set bit of this [Int] number,
* or zero, if this number is zero.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Int.takeHighestOneBit(): Int = TODO("Wasm stdlib: Numbers")
/**
* Returns a number having a single bit set in the position of the least significant set bit of this [Int] number,
* or zero, if this number is zero.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Int.takeLowestOneBit(): Int = TODO("Wasm stdlib: Numbers")
/**
* Rotates the binary representation of this [Int] number left by the specified [bitCount] number of bits.
* The most significant bits pushed out from the left side reenter the number as the least significant bits on the right side.
*
* Rotating the number left by a negative bit count is the same as rotating it right by the negated bit count:
* `number.rotateLeft(-n) == number.rotateRight(n)`
*
* Rotating by a multiple of [Int.SIZE_BITS] (32) returns the same number, or more generally
* `number.rotateLeft(n) == number.rotateLeft(n % 32)`
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Int.rotateLeft(bitCount: Int): Int = TODO("Wasm stdlib: Numbers")
/**
* Rotates the binary representation of this [Int] number right by the specified [bitCount] number of bits.
* The least significant bits pushed out from the right side reenter the number as the most significant bits on the left side.
*
* Rotating the number right by a negative bit count is the same as rotating it left by the negated bit count:
* `number.rotateRight(-n) == number.rotateLeft(n)`
*
* Rotating by a multiple of [Int.SIZE_BITS] (32) returns the same number, or more generally
* `number.rotateRight(n) == number.rotateRight(n % 32)`
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Int.rotateRight(bitCount: Int): Int = TODO("Wasm stdlib: Numbers")
/**
* Counts the number of set bits in the binary representation of this [Long] number.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Long.countOneBits(): Int = TODO("Wasm stdlib: Numbers")
/**
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Long] number.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Long.countLeadingZeroBits(): Int = TODO("Wasm stdlib: Numbers")
/**
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Long] number.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Long.countTrailingZeroBits(): Int = TODO("Wasm stdlib: Numbers")
/**
* Returns a number having a single bit set in the position of the most significant set bit of this [Long] number,
* or zero, if this number is zero.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Long.takeHighestOneBit(): Long = TODO("Wasm stdlib: Numbers")
/**
* Returns a number having a single bit set in the position of the least significant set bit of this [Long] number,
* or zero, if this number is zero.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Long.takeLowestOneBit(): Long = TODO("Wasm stdlib: Numbers")
/**
* Rotates the binary representation of this [Long] number left by the specified [bitCount] number of bits.
* The most significant bits pushed out from the left side reenter the number as the least significant bits on the right side.
*
* Rotating the number left by a negative bit count is the same as rotating it right by the negated bit count:
* `number.rotateLeft(-n) == number.rotateRight(n)`
*
* Rotating by a multiple of [Long.SIZE_BITS] (64) returns the same number, or more generally
* `number.rotateLeft(n) == number.rotateLeft(n % 64)`
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Long.rotateLeft(bitCount: Int): Long = TODO("Wasm stdlib: Numbers")
/**
* Rotates the binary representation of this [Long] number right by the specified [bitCount] number of bits.
* The least significant bits pushed out from the right side reenter the number as the most significant bits on the left side.
*
* Rotating the number right by a negative bit count is the same as rotating it left by the negated bit count:
* `number.rotateRight(-n) == number.rotateLeft(n)`
*
* Rotating by a multiple of [Long.SIZE_BITS] (64) returns the same number, or more generally
* `number.rotateRight(n) == number.rotateRight(n % 64)`
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public actual fun Long.rotateRight(bitCount: Int): Long = TODO("Wasm stdlib: Numbers")