[K/JS] Support eager initialization for per-file granularity

This commit is contained in:
Artem Kobzar
2023-09-06 09:27:28 +00:00
committed by Space Team
parent f203681ffa
commit bff433f4e9
22 changed files with 288 additions and 29 deletions
@@ -0,0 +1,19 @@
// TARGET_BACKEND: JS_IR
// IGNORE_BACKEND: WASM
// ES_MODULES
// PROPERTY_LAZY_INITIALIZATION
// FILE: lib.kt
var z1 = false
// FILE: lib2.kt
@OptIn(kotlin.ExperimentalStdlibApi::class)
@EagerInitialization
val x = run { z1 = !z1; 42 }
val y = run { 73 }
fun box(): String {
return if (z1) "OK" else "fail"
}