Dropped confusing method signature

This commit is contained in:
Valentin Kipyatkov
2015-02-09 20:11:03 +03:00
parent e57799ca00
commit 2c5953dbe6
4 changed files with 3 additions and 7 deletions
@@ -30,10 +30,6 @@ import org.jetbrains.kotlin.idea.search.allScope
import org.jetbrains.kotlin.utils.addIfNotNull
public object DescriptorToDeclarationUtil {
public fun getDeclaration(file: JetFile, descriptor: DeclarationDescriptor): PsiElement? {
return getDeclaration(file.getProject(), descriptor)
}
public fun getDeclaration(project: Project, descriptor: DeclarationDescriptor): PsiElement? {
var elements: Collection<PsiElement> = DescriptorToSourceUtils.descriptorToDeclarations(descriptor)
if (elements.isEmpty()) {
@@ -69,7 +69,7 @@ public abstract class OverrideImplementMethodsHandler implements LanguageCodeIns
) {
List<DescriptorClassMember> members = new ArrayList<DescriptorClassMember>();
for (CallableMemberDescriptor memberDescriptor : missingImplementations) {
PsiElement declaration = DescriptorToDeclarationUtil.INSTANCE$.getDeclaration(file, memberDescriptor);
PsiElement declaration = DescriptorToDeclarationUtil.INSTANCE$.getDeclaration(file.getProject(), memberDescriptor);
if (declaration == null) {
LOG.error("Can not find declaration for descriptor " + memberDescriptor);
}
@@ -76,7 +76,7 @@ public class CreateCallableFromUsageFix(
val containers = receiverTypeCandidates
.map { candidate ->
val descriptor = candidate.theType.getConstructor().getDeclarationDescriptor()
val declaration = DescriptorToDeclarationUtil.getDeclaration(file, descriptor)
val declaration = DescriptorToDeclarationUtil.getDeclaration(project, descriptor)
if (declaration is JetClassOrObject || declaration is PsiClass) candidate to declaration else null
}
.filterNotNull()
@@ -83,7 +83,7 @@ public fun JetElement.getInternalReferencesToUpdateOnPackageNameChange(packageNa
fun processReference(refExpr: JetSimpleNameExpression, bindingContext: BindingContext): UsageInfo? {
val descriptor = bindingContext[BindingContext.REFERENCE_TARGET, refExpr]?.getImportableDescriptor() ?: return null
val declaration = DescriptorToDeclarationUtil.getDeclaration(file, descriptor) ?: return null
val declaration = DescriptorToDeclarationUtil.getDeclaration(getProject(), descriptor) ?: return null
if (isAncestor(declaration, false)) return null
val isCallable = descriptor is CallableDescriptor