From b5fb0d9f33f9df94cbb03ab936372175993cc60a Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 27 Sep 2021 16:58:03 +0300 Subject: [PATCH] [JS IR] Deprecate safeProperty(Get|Set) methods from stdlib --- libraries/stdlib/js-ir/runtime/kotlinJsHacks.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/stdlib/js-ir/runtime/kotlinJsHacks.kt b/libraries/stdlib/js-ir/runtime/kotlinJsHacks.kt index c4d6699ffb6..959fea1b03b 100644 --- a/libraries/stdlib/js-ir/runtime/kotlinJsHacks.kt +++ b/libraries/stdlib/js-ir/runtime/kotlinJsHacks.kt @@ -13,13 +13,17 @@ internal fun > enumValuesIntrinsic(): Array = internal fun > enumValueOfIntrinsic(@Suppress("UNUSED_PARAMETER") name: String): T = throw IllegalStateException("Should be replaced by compiler") -@PublishedApi +// These were necessary for legacy-property-access functionality in IR +// But this functionality is not required anymore, so these methods are redundant +// But they can't be removed because if old version of compiler will compile against new version of stdlib +// (when these methods are removed) compiler will fail with Internal error +@Deprecated("This is an intrinsic for removed functionality", level = DeprecationLevel.HIDDEN) internal fun safePropertyGet(self: dynamic, getterName: String, propName: String): dynamic { val getter = self[getterName] return if (getter != null) getter.call(self) else self[propName] } -@PublishedApi +@Deprecated("This is an intrinsic for removed functionality", level = DeprecationLevel.HIDDEN) internal fun safePropertySet(self: dynamic, setterName: String, propName: String, value: dynamic) { val setter = self[setterName] if (setter != null) setter.call(self, value) else self[propName] = value