Redundant companion reference: minor refactoring

This commit is contained in:
Mikhail Glukhikh
2018-06-19 11:30:07 +03:00
parent 5ad98a139d
commit b87dd07dd1
2 changed files with 11 additions and 9 deletions
@@ -480,6 +480,10 @@ fun KtClassOrObject.findPropertyByName(name: String): KtNamedDeclaration? {
?: primaryConstructorParameters.firstOrNull { it.hasValOrVar() && it.name == name }
}
fun KtClassOrObject.findFunctionByName(name: String): KtNamedDeclaration? {
return declarations.firstOrNull { it is KtNamedFunction && it.name == name } as KtNamedDeclaration?
}
fun isTypeConstructorReference(e: PsiElement): Boolean {
val parent = e.parent
return parent is KtUserType && parent.referenceExpression == e