Pull Up/Extract Super: Support members declared in the companion object of the original class

This commit is contained in:
Alexey Sedunov
2016-09-20 19:06:25 +03:00
parent 982d4d4ead
commit 8a5628cde5
18 changed files with 132 additions and 24 deletions
@@ -139,4 +139,17 @@ abstract class KtNamedDeclarationStub<T extends KotlinStubWithFqName<?>> extends
}
return KtNamedDeclarationUtil.getFQName(this);
}
@Override
public void delete() throws IncorrectOperationException {
KtClassOrObject classOrObject = KtPsiUtilKt.getContainingClassOrObject(this);
super.delete();
if (classOrObject instanceof KtObjectDeclaration
&& ((KtObjectDeclaration) classOrObject).isCompanion()
&& classOrObject.getDeclarations().isEmpty()) {
classOrObject.delete();
}
}
}