(U|S)LC: fix getText for modifier list / accessor
This commit is contained in:
committed by
Ilya Kirillov
parent
e1344968ec
commit
dbf0ba442a
+15
-11
@@ -122,22 +122,26 @@ abstract class KtLightMethodImpl protected constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getTextOffset(): Int {
|
||||
private inline fun <R> getTextVariantFromPropertyAccessorIfNeeded(
|
||||
retriever: (KtPropertyAccessor) -> R
|
||||
): R? {
|
||||
val auxiliaryOrigin = lightMemberOrigin?.auxiliaryOriginalElement
|
||||
if (auxiliaryOrigin is KtPropertyAccessor) {
|
||||
return auxiliaryOrigin.textOffset
|
||||
}
|
||||
return (auxiliaryOrigin as? KtPropertyAccessor)?.let(retriever)
|
||||
}
|
||||
|
||||
return super.getTextOffset()
|
||||
override fun getText(): String {
|
||||
return getTextVariantFromPropertyAccessorIfNeeded(KtPropertyAccessor::getText)
|
||||
?: super.getText()
|
||||
}
|
||||
|
||||
override fun getTextOffset(): Int {
|
||||
return getTextVariantFromPropertyAccessorIfNeeded(KtPropertyAccessor::getTextOffset)
|
||||
?: super.getTextOffset()
|
||||
}
|
||||
|
||||
override fun getTextRange(): TextRange {
|
||||
val auxiliaryOrigin = lightMemberOrigin?.auxiliaryOriginalElement
|
||||
if (auxiliaryOrigin is KtPropertyAccessor) {
|
||||
return auxiliaryOrigin.textRange
|
||||
}
|
||||
|
||||
return super.getTextRange()
|
||||
return getTextVariantFromPropertyAccessorIfNeeded(KtPropertyAccessor::getTextRange)
|
||||
?: super.getTextRange()
|
||||
}
|
||||
|
||||
abstract override fun getThrowsList(): PsiReferenceList
|
||||
|
||||
Reference in New Issue
Block a user