Supported renaming of default object. Named only objects are supported
yet.
This commit is contained in:
@@ -174,4 +174,12 @@ public abstract class KotlinLightField<T extends JetDeclaration, D extends PsiFi
|
||||
public Language getLanguage() {
|
||||
return JetLanguage.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEquivalentTo(PsiElement another) {
|
||||
if (another instanceof KotlinLightField && origin.isEquivalentTo(((KotlinLightField) another).getOrigin())) {
|
||||
return true;
|
||||
}
|
||||
return super.isEquivalentTo(another);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +149,20 @@ public class LightClassUtil {
|
||||
return getPsiMethodWrapper(accessor);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiField getLightFieldForDefaultObject(@NotNull JetClassOrObject defaultObject) {
|
||||
PsiClass outerPsiClass = getWrappingClass(defaultObject);
|
||||
if (outerPsiClass != null) {
|
||||
for (PsiField fieldOfParent : outerPsiClass.getFields()) {
|
||||
if (((KotlinLightElement<?, ?>) fieldOfParent).getOrigin() == defaultObject &&
|
||||
fieldOfParent.getName().equals(defaultObject.getName())) { // TODO this check is relevant while light class has deprecated OBJECT$ field
|
||||
return fieldOfParent;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PropertyAccessorsPsiMethods getLightClassPropertyMethods(@NotNull JetProperty property) {
|
||||
JetPropertyAccessor getter = property.getGetter();
|
||||
|
||||
Reference in New Issue
Block a user