Search: Optimize usage scope of class members

#KT-9285 Fixed
This commit is contained in:
Alexey Sedunov
2016-08-22 12:40:39 +03:00
parent e908c6c1b2
commit d9698dfa4d
2 changed files with 10 additions and 1 deletions
+1
View File
@@ -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
@@ -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<T extends KotlinStubWithFqName<?>> extends
}
}
return super.getUseScope();
SearchScope scope = super.getUseScope();
KtClassOrObject classOrObject = KtPsiUtilKt.getContainingClassOrObject(this);
if (classOrObject != null) {
scope = scope.intersectWith(classOrObject.getUseScope());
}
return scope;
}
@Nullable