Find Usages: Support of secondary constructors and delegation calls

This commit is contained in:
Alexey Sedunov
2015-03-19 21:08:52 +03:00
parent 312a1db273
commit d19e6337a3
28 changed files with 342 additions and 27 deletions
@@ -54,8 +54,13 @@ public fun PsiReference.matchesTarget(candidateTarget: PsiElement): Boolean {
|| it is JetObjectDeclaration && it.isCompanion() && it.getNonStrictParentOfType<JetClass>() == unwrappedCandidate
}
}
else {
if (targets.any { unwrappedCandidate.isConstructorOf(it) }) return true
// TODO: Workaround for Kotlin constructor search in Java code. To be removed after refactoring of the search API
else if (this is PsiJavaCodeReferenceElement && unwrappedCandidate is JetSecondaryConstructor) {
var parent = getElement().getParent()
if (parent is PsiAnonymousClass) {
parent = parent.getParent()
}
if ((parent as? PsiNewExpression)?.resolveConstructor()?.unwrapped == unwrappedCandidate) return true
}
if (this is PsiReferenceExpression && candidateTarget is JetObjectDeclaration && unwrappedTargets.size() == 1) {
val referredClass = unwrappedTargets.first()