Rename: Rename do-while loop variables in the loop condition

#KT-14157 Fixed
This commit is contained in:
Alexey Sedunov
2016-10-04 14:22:13 +03:00
parent 140d0b61f1
commit fe711da594
9 changed files with 53 additions and 1 deletions
@@ -103,7 +103,18 @@ abstract class KtNamedDeclarationStub<T extends KotlinStubWithFqName<?>> extends
@Override
public SearchScope getUseScope() {
KtElement enclosingBlock = KtPsiUtil.getEnclosingElementForLocalDeclaration(this, false);
if (enclosingBlock != null) return new LocalSearchScope(enclosingBlock);
if (enclosingBlock != null) {
PsiElement enclosingParent = enclosingBlock.getParent();
if (enclosingParent instanceof KtContainerNode) {
enclosingParent = enclosingParent.getParent();
}
if (enclosingBlock instanceof KtBlockExpression && enclosingParent instanceof KtDoWhileExpression) {
KtExpression condition = ((KtDoWhileExpression) enclosingParent).getCondition();
if (condition != null) return new LocalSearchScope(new PsiElement[] { enclosingBlock, condition });
}
return new LocalSearchScope(enclosingBlock);
}
if (hasModifier(KtTokens.PRIVATE_KEYWORD)) {
KtElement containingClass = PsiTreeUtil.getParentOfType(this, KtClassOrObject.class);