[stdlib] Explicit visibility and return types: Wasm

This commit is contained in:
Ilya Gorbunov
2023-11-12 02:09:15 +01:00
committed by Space Team
parent 381a8fd55f
commit cfa8a1dc0f
15 changed files with 54 additions and 54 deletions
@@ -23,7 +23,7 @@ internal suspend fun <T> returnIfSuspended(argument: Any?): T =
internal fun <T> interceptContinuationIfNeeded(
context: CoroutineContext,
continuation: Continuation<T>
) = context[ContinuationInterceptor]?.interceptContinuation(continuation) ?: continuation
): Continuation<T> = context[ContinuationInterceptor]?.interceptContinuation(continuation) ?: continuation
@PublishedApi
@@ -68,6 +68,6 @@ internal fun <R, P, T> startCoroutineUninterceptedOrReturnIntrinsic2(
@PublishedApi
@SinceKotlin("1.3")
internal val EmptyContinuation = Continuation<Any?>(EmptyCoroutineContext) { result ->
internal val EmptyContinuation: Continuation<Any?> = Continuation(EmptyCoroutineContext) { result ->
result.getOrThrow()
}
@@ -15,12 +15,12 @@ import kotlin.wasm.internal.jsToKotlinStringAdapter
* @param message the detail message string.
* @param cause the cause of this throwable.
*/
public open class Throwable(open val message: String?, open val cause: kotlin.Throwable?) {
constructor(message: String?) : this(message, null)
public open class Throwable(public open val message: String?, public open val cause: kotlin.Throwable?) {
public constructor(message: String?) : this(message, null)
constructor(cause: Throwable?) : this(cause?.toString(), cause)
public constructor(cause: Throwable?) : this(cause?.toString(), cause)
constructor() : this(null, null)
public constructor() : this(null, null)
internal val jsStack: ExternalInterfaceType = captureStackTrace()
@@ -17,14 +17,14 @@ public external interface Dynamic : JsAny
* Reinterprets this value as a value of the Dynamic type.
*/
@Deprecated("If value is a subtype of JsAny, use JsAny instead. Otherwise, use toJsReference", level = DeprecationLevel.ERROR)
fun Any.asDynamic(): JsAny = this.toJsReference()
public fun Any.asDynamic(): JsAny = this.toJsReference()
/**
* Reinterprets this value as a value of the Dynamic type.
*/
@Deprecated("Use toJsString instead", level = DeprecationLevel.ERROR, replaceWith = ReplaceWith("this.toJsString()"))
@kotlin.internal.InlineOnly
fun String.asDynamic(): JsString = this.toJsString()
public fun String.asDynamic(): JsString = this.toJsString()
private fun jsThrow(e: JsAny) {
js("throw e;")
@@ -8,7 +8,7 @@ package kotlin.js
/** JavaScript Array */
@JsName("Array")
public external class JsArray<T : JsAny?> : JsAny {
val length: Int
public val length: Int
}
public operator fun <T : JsAny?> JsArray<T>.get(index: Int): T? =
@@ -20,7 +20,7 @@ public external class Promise<out T : JsAny?>(executor: (resolve: (T) -> Unit, r
public fun <S : JsAny?> catch(onRejected: (JsAny) -> S): Promise<S>
public fun finally(onFinally: () -> Unit): Promise<T>
companion object {
public companion object {
public fun <S : JsAny?> all(promise: JsArray<out Promise<S>>): Promise<JsArray<out S>>
public fun <S : JsAny?> race(promise: JsArray<out Promise<S>>): Promise<S>
public fun reject(e: JsAny): Promise<Nothing>
+6 -6
View File
@@ -140,33 +140,33 @@ public actual inline fun Long.rotateRight(bitCount: Int): Long =
* Returns `true` if the specified number is a
* Not-a-Number (NaN) value, `false` otherwise.
*/
actual fun Double.isNaN(): Boolean = this != this
public actual fun Double.isNaN(): Boolean = this != this
/**
* Returns `true` if the specified number is a
* Not-a-Number (NaN) value, `false` otherwise.
*/
actual fun Float.isNaN(): Boolean = this != this
public actual fun Float.isNaN(): Boolean = this != this
/**
* Returns `true` if this value is infinitely large in magnitude.
*/
actual fun Double.isInfinite(): Boolean = (this == Double.POSITIVE_INFINITY) || (this == Double.NEGATIVE_INFINITY)
public actual fun Double.isInfinite(): Boolean = (this == Double.POSITIVE_INFINITY) || (this == Double.NEGATIVE_INFINITY)
/**
* Returns `true` if this value is infinitely large in magnitude.
*/
actual fun Float.isInfinite(): Boolean = (this == Float.POSITIVE_INFINITY) || (this == Float.NEGATIVE_INFINITY)
public actual fun Float.isInfinite(): Boolean = (this == Float.POSITIVE_INFINITY) || (this == Float.NEGATIVE_INFINITY)
/**
* Returns `true` if the argument is a finite floating-point value; returns `false` otherwise (for `NaN` and infinity arguments).
*/
actual fun Double.isFinite(): Boolean = !isInfinite() && !isNaN()
public actual fun Double.isFinite(): Boolean = !isInfinite() && !isNaN()
/**
* Returns `true` if the argument is a finite floating-point value; returns `false` otherwise (for `NaN` and infinity arguments).
*/
actual fun Float.isFinite(): Boolean = !isInfinite() && !isNaN()
public actual fun Float.isFinite(): Boolean = !isInfinite() && !isNaN()
/**
* Returns a bit representation of the specified floating-point value as [Long]
@@ -7,8 +7,8 @@ package kotlin.coroutines.cancellation
@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)
public actual constructor() : super()
public actual constructor(message: String?) : super(message)
public constructor(message: String?, cause: Throwable?) : super(message, cause)
public constructor(cause: Throwable?) : super(cause)
}
@@ -11,5 +11,5 @@ package kotlin.text
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public actual open class CharacterCodingException(message: String?) : Exception(message) {
actual constructor() : this(null)
public actual constructor() : this(null)
}
@@ -13,13 +13,13 @@ import kotlin.wasm.internal.wasm_f32_demote_f64
*
* There are also strict versions of the function available on non-nullable String, [toBooleanStrict] and [toBooleanStrictOrNull].
*/
actual fun String?.toBoolean(): Boolean = this != null && this.lowercase() == "true"
public actual fun String?.toBoolean(): Boolean = this != null && this.lowercase() == "true"
/**
* 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 = toByteOrNull() ?: numberFormatError(this)
public actual fun String.toByte(): Byte = toByteOrNull() ?: numberFormatError(this)
/**
* Parses the string as a signed [Byte] number and returns the result.
@@ -119,7 +119,7 @@ public actual fun Short.toString(radix: Int): String = this.toLong().toString(ra
* @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
*/
@SinceKotlin("1.2")
actual fun Int.toString(radix: Int): String = toLong().toString(radix)
public actual fun Int.toString(radix: Int): String = toLong().toString(radix)
/**
* Returns a string representation of this [Long] value in the specified [radix].
@@ -127,7 +127,7 @@ actual fun Int.toString(radix: Int): String = toLong().toString(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 {
public actual fun Long.toString(radix: Int): String {
checkRadix(radix)
fun Long.getChar() = toInt().let { if (it < 10) '0' + it else 'a' + (it - 10) }
@@ -513,7 +513,7 @@ public actual fun CharSequence.isBlank(): Boolean = length == 0 || indices.all {
* @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(
public actual fun CharSequence.regionMatches(
thisOffset: Int,
other: CharSequence,
otherOffset: Int,
@@ -13,12 +13,12 @@ import kotlin.wasm.internal.getSimpleName
* @param message the detail message string.
* @param cause the cause of this throwable.
*/
public open class Throwable(open val message: String?, open val cause: kotlin.Throwable?) {
constructor(message: String?) : this(message, null)
public open class Throwable(public open val message: String?, public open val cause: kotlin.Throwable?) {
public constructor(message: String?) : this(message, null)
constructor(cause: Throwable?) : this(cause?.toString(), cause)
public constructor(cause: Throwable?) : this(cause?.toString(), cause)
constructor() : this(null, null)
public constructor() : this(null, null)
//TODO: Investigate possibility to make WASI stack discoverable (KT-60965)
internal val stack: String get() = ""