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:
committed by
Space Team
parent
bd7bce9f97
commit
cb4fb15093
@@ -19,6 +19,9 @@ package org.jetbrains.kotlin.name
|
|||||||
object NameUtils {
|
object NameUtils {
|
||||||
private val SANITIZE_AS_JAVA_INVALID_CHARACTERS = "[^\\p{L}\\p{Digit}]".toRegex()
|
private val SANITIZE_AS_JAVA_INVALID_CHARACTERS = "[^\\p{L}\\p{Digit}]".toRegex()
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
val CONTEXT_RECEIVER_PREFIX = "\$context_receiver"
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun sanitizeAsJavaIdentifier(name: String): String {
|
fun sanitizeAsJavaIdentifier(name: String): String {
|
||||||
return SANITIZE_AS_JAVA_INVALID_CHARACTERS.replace(name, "_")
|
return SANITIZE_AS_JAVA_INVALID_CHARACTERS.replace(name, "_")
|
||||||
@@ -64,5 +67,5 @@ object NameUtils {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun contextReceiverName(index: Int): Name =
|
fun contextReceiverName(index: Int): Name =
|
||||||
Name.identifier("\$context_receiver_$index")
|
Name.identifier("${CONTEXT_RECEIVER_PREFIX}_$index")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user