[Wasm] Rewrite lazy initialization without by lazy and lateinit to reduce overhead

This commit is contained in:
Zalim Bashorov
2023-03-30 20:47:01 +02:00
parent 1a8a4fa65d
commit 295acdf2af
7 changed files with 42 additions and 27 deletions
@@ -24,13 +24,16 @@ public open class Throwable(open val message: String?, open val cause: kotlin.Th
private val jsStack: ExternalInterfaceType = captureStackTrace()
private lateinit var _stack: String
private var _stack: String? = null
internal val stack: String
get() {
if (!::_stack.isInitialized) {
_stack = jsToKotlinStringAdapter(jsStack).removePrefix("Error\n")
var value = _stack
if (value == null) {
value = jsToKotlinStringAdapter(jsStack).removePrefix("Error\n")
_stack = value
}
return _stack
return value
}
internal var suppressedExceptionsList: MutableList<Throwable>? = null