From d9698dfa4d42cdd6a22c09d90e730b53bfeb0ef0 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Mon, 22 Aug 2016 12:40:39 +0300 Subject: [PATCH] Search: Optimize usage scope of class members #KT-9285 Fixed --- ChangeLog.md | 1 + .../jetbrains/kotlin/psi/KtNamedDeclarationStub.java | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 6817128742a..0ac76fd14e4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -98,6 +98,7 @@ These artifacts include extensions for the types available in the latter JDKs, s - [`KT-9125`](https://youtrack.jetbrains.com/issue/KT-9125) Support Type Hierarchy on references inside of super type call entries - [`KT-13542`](https://youtrack.jetbrains.com/issue/KT-13542) Rename: Do not search parameter text occurrences outside of its containing declaration - [`KT-8672`](https://youtrack.jetbrains.com/issue/KT-8672) Rename: Optimize search of parameter references in calls with named arguments +- [`KT-9285`](https://youtrack.jetbrains.com/issue/KT-9285) Rename: Optimize search of private class members #### Refactorings diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNamedDeclarationStub.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNamedDeclarationStub.java index 412f0e7d65c..7aa837be3eb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNamedDeclarationStub.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNamedDeclarationStub.java @@ -29,6 +29,7 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.lexer.KtTokens; import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.name.Name; +import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt; import org.jetbrains.kotlin.psi.stubs.KotlinStubWithFqName; import org.jetbrains.kotlin.types.expressions.OperatorConventions; @@ -117,7 +118,14 @@ abstract class KtNamedDeclarationStub> extends } } - return super.getUseScope(); + SearchScope scope = super.getUseScope(); + + KtClassOrObject classOrObject = KtPsiUtilKt.getContainingClassOrObject(this); + if (classOrObject != null) { + scope = scope.intersectWith(classOrObject.getUseScope()); + } + + return scope; } @Nullable