[WASM] Implement lazy with UnsafeLazyImpl

This commit is contained in:
Igor Yakovlev
2021-12-02 17:31:55 +01:00
committed by TeamCityServer
parent d55e16a030
commit ea060dcf8a
7 changed files with 6 additions and 20 deletions
+6 -10
View File
@@ -25,10 +25,6 @@ public actual fun interface Comparator<T> {
public actual fun compare(a: T, b: T): Int
}
// From kotlin.kt
// From numbers.kt
actual fun Double.isNaN(): Boolean = this != this
@@ -87,22 +83,22 @@ public actual fun Float.Companion.fromBits(bits: Int): Float = wasm_f32_reinterp
//@Deprecated("Use Volatile annotation from kotlin.jvm package", ReplaceWith("kotlin.jvm.Volatile"), level = DeprecationLevel.WARNING)
//public typealias Volatile = kotlin.jvm.Volatile
// 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].
*/
public actual fun <T> lazy(initializer: () -> T): Lazy<T> = UnsafeLazyImpl(initializer)
/**
* 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")
public actual fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T> = UnsafeLazyImpl(initializer)
/**
* 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")
public actual fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T> = UnsafeLazyImpl(initializer)