Delete unneeded method from PsiCodegenPredictor
This commit is contained in:
@@ -88,7 +88,6 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
null,
|
||||
false);
|
||||
|
||||
assert PsiCodegenPredictor.checkPredictedClassNameForFun(bindingContext, funDescriptor, classDescriptor);
|
||||
bindingTrace.record(CLASS_FOR_FUNCTION, funDescriptor, classDescriptor);
|
||||
return classDescriptor;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,6 @@ public class CodegenBinding {
|
||||
|
||||
recordClosure(bindingTrace, null, classDescriptor, null, className, false);
|
||||
|
||||
assert PsiCodegenPredictor.checkPredictedClassNameForFun(bindingTrace.getBindingContext(), scriptDescriptor, classDescriptor);
|
||||
bindingTrace.record(CLASS_FOR_SCRIPT, scriptDescriptor, classDescriptor);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.codegen.NamespaceCodegen;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
@@ -151,47 +150,6 @@ public final class PsiCodegenPredictor {
|
||||
JvmClassName.byInternalName(packageName.getInternalName() + "/" + packageClassName);
|
||||
}
|
||||
|
||||
public static boolean checkPredictedClassNameForFun(
|
||||
BindingContext bindingContext, @NotNull DeclarationDescriptor descriptor,
|
||||
ClassDescriptor classDescriptor
|
||||
) {
|
||||
PsiElement element = descriptorToDeclaration(bindingContext, descriptor);
|
||||
PsiElement classDeclaration = descriptorToDeclaration(bindingContext, classDescriptor);
|
||||
if (element instanceof JetNamedFunction && classDeclaration instanceof JetDeclaration) {
|
||||
JvmClassName classNameFromPsi = getPredefinedJvmClassName((JetDeclaration) classDeclaration);
|
||||
JvmClassName classNameForFun = getPredefinedJvmClassNameForFun((JetNamedFunction) element);
|
||||
assert classNameForFun == null || classNameForFun.equals(classNameFromPsi) : "Invalid algorithm for getting enclosing method name!";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static JvmClassName getPredefinedJvmClassNameForFun(@NotNull JetNamedFunction function) {
|
||||
PsiElement parent = function.getParent();
|
||||
if (parent instanceof JetFile) {
|
||||
return getPredefinedJvmClassName((JetFile) parent, true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
JetClass containingClass = PsiTreeUtil.getParentOfType(function, JetClass.class, true, JetDeclaration.class);
|
||||
if (containingClass != null) {
|
||||
return getPredefinedJvmClassName(containingClass);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
JetObjectDeclaration objectDeclaration = PsiTreeUtil.getParentOfType(function, JetObjectDeclaration.class, true, JetDeclaration.class);
|
||||
if (objectDeclaration != null) {
|
||||
if (objectDeclaration.getParent() instanceof JetClassObject) {
|
||||
return getPredefinedJvmClassName((JetClassObject) objectDeclaration.getParent());
|
||||
}
|
||||
|
||||
return getPredefinedJvmClassName(objectDeclaration);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static JetFile getFileForNamespacePartName(@NotNull Collection<JetFile> allNamespaceFiles, @NotNull JvmClassName className) {
|
||||
for (JetFile file : allNamespaceFiles) {
|
||||
|
||||
Reference in New Issue
Block a user