Uast: KotlinPrimaryConstructorUMethod renamed to KotlinConstructorUMethod (KT-21409)

This commit is contained in:
Nicolay Mitropolsky
2017-11-24 19:10:17 +03:00
committed by xiexed
parent 1ce21583ad
commit 77be33d433
2 changed files with 7 additions and 3 deletions
@@ -103,7 +103,7 @@ fun doConvertParent(element: UElement, parent: PsiElement?): UElement? {
val containingClass = parent.containingClassOrObject
if (containingClass != null) {
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
}
}
@@ -76,7 +76,7 @@ open class KotlinUClass private constructor(
fun createUMethod(psiMethod: PsiMethod): UMethod {
return if (psiMethod is KtLightMethod &&
psiMethod.isConstructor) {
KotlinPrimaryConstructorUMethod(ktClass, psiMethod, this)
KotlinConstructorUMethod(ktClass, psiMethod, this)
} else {
getLanguagePlugin().convert(psiMethod, this)
}
@@ -102,11 +102,15 @@ open class KotlinUClass private constructor(
}
}
class KotlinPrimaryConstructorUMethod(
class KotlinConstructorUMethod(
private val ktClass: KtClassOrObject?,
override val psi: KtLightMethod,
override val uastParent: UElement?
): KotlinUMethod(psi, uastParent) {
val isPrimary: Boolean
get() = psi.kotlinOrigin is KtPrimaryConstructor
override val uastBody: UExpression? by lz {
val delegationCall: KtCallElement? = psi.kotlinOrigin.let {
when (it) {