From afab52c3bc50489b81ac1daef23e479ff939c7c1 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 6 Mar 2020 18:47:00 +0300 Subject: [PATCH] Remove workarounds that called primary constructor manually --- libraries/stdlib/js/src/kotlin/exceptions.kt | 29 ++++---------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/libraries/stdlib/js/src/kotlin/exceptions.kt b/libraries/stdlib/js/src/kotlin/exceptions.kt index 918fd22cd07..207af95614c 100644 --- a/libraries/stdlib/js/src/kotlin/exceptions.kt +++ b/libraries/stdlib/js/src/kotlin/exceptions.kt @@ -16,37 +16,20 @@ public open class MyException : Exception { */ -// TODO: remove workarounds for KT-22053 from direct Throwable inheritors // TODO: remove primary constructors, make all secondary KT-22055 @Suppress("USELESS_ELVIS_RIGHT_IS_NULL") public actual open class Error actual constructor(message: String?, cause: Throwable?) : Throwable(message, cause ?: null) { - actual constructor() : this(null, null) { - Error::class.js.asDynamic().call(this, null, null) - } - - actual constructor(message: String?) : this(message, null) { - Error::class.js.asDynamic().call(this, message, null) - } - - actual constructor(cause: Throwable?) : this(undefined, cause) { - Error::class.js.asDynamic().call(this, undefined, cause) - } + actual constructor() : this(null, null) + actual constructor(message: String?) : this(message, null) + actual constructor(cause: Throwable?) : this(undefined, cause) } @Suppress("USELESS_ELVIS_RIGHT_IS_NULL") public actual open class Exception actual constructor(message: String?, cause: Throwable?) : Throwable(message, cause ?: null) { - actual constructor() : this(null, null) { - Exception::class.js.asDynamic().call(this, null, null) - } - - actual constructor(message: String?) : this(message, null) { - Exception::class.js.asDynamic().call(this, message, null) - } - - actual constructor(cause: Throwable?) : this(undefined, cause) { - Exception::class.js.asDynamic().call(this, undefined, cause) - } + actual constructor() : this(null, null) + actual constructor(message: String?) : this(message, null) + actual constructor(cause: Throwable?) : this(undefined, cause) } public actual open class RuntimeException actual constructor(message: String?, cause: Throwable?) : Exception(message, cause) {