Making KotlinAnnotatedElementsSearcher able to search for parameters (KT-27794)
This commit is contained in:
+6
-3
@@ -57,14 +57,17 @@ open class KtLightMethodImpl protected constructor(
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun buildParametersForList(): List<PsiParameter> =
|
||||
clsDelegate.parameterList.parameters.mapIndexed { index, clsParameter ->
|
||||
protected open fun buildParametersForList(): List<PsiParameter> {
|
||||
val clsParameters by lazyPub { clsDelegate.parameterList.parameters }
|
||||
return (dummyDelegate?.parameterList?.parameters ?: clsParameters).mapIndexed { index, dummyParameter ->
|
||||
KtLightParameter(
|
||||
clsParameter,
|
||||
dummyParameter,
|
||||
{ clsParameters.getOrNull(index) },
|
||||
index,
|
||||
this@KtLightMethodImpl
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private val typeParamsList: PsiTypeParameterList? by lazyPub { buildTypeParameterList() }
|
||||
|
||||
|
||||
+13
-4
@@ -23,12 +23,21 @@ import org.jetbrains.kotlin.psi.KtPropertyAccessor
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isExtensionDeclaration
|
||||
|
||||
class KtLightParameter(
|
||||
override val clsDelegate: PsiParameter,
|
||||
private val index: Int,
|
||||
method: KtLightMethod
|
||||
) : LightParameter(clsDelegate.name ?: "p$index", clsDelegate.type, method, KotlinLanguage.INSTANCE),
|
||||
private val dummyDelegate: PsiParameter,
|
||||
private val clsDelegateProvider: () -> PsiParameter?,
|
||||
private val index: Int,
|
||||
method: KtLightMethod
|
||||
) : LightParameter(dummyDelegate.name ?: "p$index", dummyDelegate.type, method, KotlinLanguage.INSTANCE),
|
||||
KtLightDeclaration<KtParameter, PsiParameter> {
|
||||
|
||||
private val lazyDelegate by lazyPub { clsDelegateProvider() ?: dummyDelegate }
|
||||
|
||||
override val clsDelegate: PsiParameter get() = lazyDelegate
|
||||
|
||||
override fun getType(): PsiType = lazyDelegate.type
|
||||
|
||||
override fun getName(): String = dummyDelegate.name ?: lazyDelegate.name ?: super.getName()
|
||||
|
||||
private val lightModifierList by lazyPub { KtLightSimpleModifierList(this, emptySet()) }
|
||||
|
||||
private var lightIdentifier: KtLightIdentifier? = null
|
||||
|
||||
Reference in New Issue
Block a user