Added CONTEXT_RECEIVER_PREFIX to NameUtils for external use

The separate constant is required to support context receiver on the IDE side, see KTIJ-21214
This commit is contained in:
Anastasia.Nekrasova
2023-04-03 19:52:43 +03:00
committed by Space Team
parent bd7bce9f97
commit cb4fb15093
@@ -19,6 +19,9 @@ package org.jetbrains.kotlin.name
object NameUtils {
private val SANITIZE_AS_JAVA_INVALID_CHARACTERS = "[^\\p{L}\\p{Digit}]".toRegex()
@JvmStatic
val CONTEXT_RECEIVER_PREFIX = "\$context_receiver"
@JvmStatic
fun sanitizeAsJavaIdentifier(name: String): String {
return SANITIZE_AS_JAVA_INVALID_CHARACTERS.replace(name, "_")
@@ -64,5 +67,5 @@ object NameUtils {
@JvmStatic
fun contextReceiverName(index: Int): Name =
Name.identifier("\$context_receiver_$index")
Name.identifier("${CONTEXT_RECEIVER_PREFIX}_$index")
}