[Stubs] Fix stub inconsistency on unnamed setter parameters
If an unused setter parameter was replaced with an underscore ('_'),
it had a special name in the stub ('<anonymous parameter 0>'). The text
version of the stub inserted it as is, leading to an extra
'PsiErrorElement'.
^KTIJ-28194 Fixed
This commit is contained in:
@@ -88,6 +88,18 @@ object SpecialNames {
|
||||
return Name.special("<index_$idx>")
|
||||
}
|
||||
|
||||
private const val ANONYMOUS_PARAMETER_NAME_PREFIX = "anonymous parameter"
|
||||
|
||||
@JvmStatic
|
||||
fun anonymousParameterName(index: Int): Name {
|
||||
return Name.special("<$ANONYMOUS_PARAMETER_NAME_PREFIX $index>")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isAnonymousParameterName(name: Name): Boolean {
|
||||
return name.isSpecial && name.asStringStripSpecialMarkers().startsWith(ANONYMOUS_PARAMETER_NAME_PREFIX)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun safeIdentifier(name: Name?): Name {
|
||||
return if (name != null && !name.isSpecial) name else SAFE_IDENTIFIER_FOR_NO_NAME
|
||||
|
||||
Reference in New Issue
Block a user