Add new functionality to "Change signature" refactoring
Extract single point of entry for all change signature refactorings and fixes (remove parameter, add parameter) Change signature now affects overriding functions as well Ask the user whether he wants to refactor base function(s) or the selected one if appropiate Fix a problem with descriptorToDeclaration in JetChangeSignatureHandler Rename: JetFunctionPlatformDescriptor -> JetMethodDescriptor
This commit is contained in:
@@ -357,4 +357,35 @@ public class BindingContextUtils {
|
||||
}
|
||||
return OverridingUtil.filterOutOverridden(result);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Set<FunctionDescriptor> getDirectlyOverriddenDeclarations(@NotNull FunctionDescriptor descriptor) {
|
||||
//noinspection unchecked
|
||||
return (Set) getDirectlyOverriddenDeclarations((CallableMemberDescriptor) descriptor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Set<PropertyDescriptor> getDirectlyOverriddenDeclarations(@NotNull PropertyDescriptor descriptor) {
|
||||
//noinspection unchecked
|
||||
return (Set) getDirectlyOverriddenDeclarations((CallableMemberDescriptor) descriptor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Set<FunctionDescriptor> getAllOverriddenDeclarations(@NotNull FunctionDescriptor functionDescriptor) {
|
||||
Set<FunctionDescriptor> result = Sets.newHashSet();
|
||||
for (FunctionDescriptor overriddenDeclaration : functionDescriptor.getOverriddenDescriptors()) {
|
||||
CallableMemberDescriptor.Kind kind = overriddenDeclaration.getKind();
|
||||
if (kind == DECLARATION) {
|
||||
result.add(overriddenDeclaration);
|
||||
}
|
||||
else if (kind == DELEGATION || kind == FAKE_OVERRIDE || kind == SYNTHESIZED) {
|
||||
//do nothing
|
||||
}
|
||||
else {
|
||||
throw new AssertionError("Unexpected callable kind " + kind);
|
||||
}
|
||||
result.addAll(getAllOverriddenDeclarations(overriddenDeclaration));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user