[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
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_LAZY
// WITH_STDLIB
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: WASM
// !LANGUAGE: +UnrestrictedBuilderInference
// IGNORE_BACKEND_FIR: JVM_IR
// FIR status: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER on lazy call (Name3, T)
-2
View File
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_LAZY
// WITH_STDLIB
fun <C : Any> diContext(context: C): DIContext<C> = DIContext(TypeToken(), context)
@@ -1,7 +1,6 @@
// WITH_STDLIB
// KJS_FULL_RUNTIME
// SKIP_MANGLE_VERIFICATION
// IGNORE_BACKEND: WASM
interface I {
companion object {
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_LAZY
// WITH_STDLIB
// MODULE: lib
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_LAZY
// WITH_STDLIB
val b: First by lazy {
+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)