Uast: KotlinPrimaryConstructorUMethod renamed to KotlinConstructorUMethod (KT-21409)
This commit is contained in:
committed by
xiexed
parent
1ce21583ad
commit
77be33d433
@@ -103,7 +103,7 @@ fun doConvertParent(element: UElement, parent: PsiElement?): UElement? {
|
|||||||
val containingClass = parent.containingClassOrObject
|
val containingClass = parent.containingClassOrObject
|
||||||
if (containingClass != null) {
|
if (containingClass != null) {
|
||||||
val containingUClass = KotlinUastLanguagePlugin().convertElementWithParent(containingClass, null) as? KotlinUClass
|
val containingUClass = KotlinUastLanguagePlugin().convertElementWithParent(containingClass, null) as? KotlinUClass
|
||||||
containingUClass?.methods?.filterIsInstance<KotlinPrimaryConstructorUMethod>()?.firstOrNull()?.let {
|
containingUClass?.methods?.filterIsInstance<KotlinConstructorUMethod>()?.firstOrNull { it.isPrimary }?.let {
|
||||||
return it.uastBody
|
return it.uastBody
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ open class KotlinUClass private constructor(
|
|||||||
fun createUMethod(psiMethod: PsiMethod): UMethod {
|
fun createUMethod(psiMethod: PsiMethod): UMethod {
|
||||||
return if (psiMethod is KtLightMethod &&
|
return if (psiMethod is KtLightMethod &&
|
||||||
psiMethod.isConstructor) {
|
psiMethod.isConstructor) {
|
||||||
KotlinPrimaryConstructorUMethod(ktClass, psiMethod, this)
|
KotlinConstructorUMethod(ktClass, psiMethod, this)
|
||||||
} else {
|
} else {
|
||||||
getLanguagePlugin().convert(psiMethod, this)
|
getLanguagePlugin().convert(psiMethod, this)
|
||||||
}
|
}
|
||||||
@@ -102,11 +102,15 @@ open class KotlinUClass private constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotlinPrimaryConstructorUMethod(
|
class KotlinConstructorUMethod(
|
||||||
private val ktClass: KtClassOrObject?,
|
private val ktClass: KtClassOrObject?,
|
||||||
override val psi: KtLightMethod,
|
override val psi: KtLightMethod,
|
||||||
override val uastParent: UElement?
|
override val uastParent: UElement?
|
||||||
): KotlinUMethod(psi, uastParent) {
|
): KotlinUMethod(psi, uastParent) {
|
||||||
|
|
||||||
|
val isPrimary: Boolean
|
||||||
|
get() = psi.kotlinOrigin is KtPrimaryConstructor
|
||||||
|
|
||||||
override val uastBody: UExpression? by lz {
|
override val uastBody: UExpression? by lz {
|
||||||
val delegationCall: KtCallElement? = psi.kotlinOrigin.let {
|
val delegationCall: KtCallElement? = psi.kotlinOrigin.let {
|
||||||
when (it) {
|
when (it) {
|
||||||
|
|||||||
Reference in New Issue
Block a user