Inlined trivial method classDescriptorToDeclaration
This commit is contained in:
@@ -73,7 +73,6 @@ import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.enumEntryNeedSubclass;
|
||||
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.isLocalNamedFun;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.classDescriptorToDeclaration;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.descriptorToDeclaration;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
|
||||
@@ -936,7 +935,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
return;
|
||||
}
|
||||
|
||||
PsiElement classElement = classDescriptorToDeclaration(declarationDescriptor);
|
||||
PsiElement classElement = DescriptorToSourceUtils.getSourceFromDescriptor(declarationDescriptor);
|
||||
if (classElement != null) {
|
||||
Integer lineNumber = CodegenUtil.getLineNumberForElement(classElement, false);
|
||||
if (lineNumber != null) {
|
||||
|
||||
+1
-2
@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
@@ -125,7 +124,7 @@ public class CliLightClassGenerationSupport extends LightClassGenerationSupport
|
||||
return ContainerUtil.mapNotNull(classDescriptors, new Function<ClassDescriptor, JetClassOrObject>() {
|
||||
@Override
|
||||
public JetClassOrObject fun(ClassDescriptor descriptor) {
|
||||
PsiElement element = DescriptorToSourceUtils.classDescriptorToDeclaration(descriptor);
|
||||
PsiElement element = DescriptorToSourceUtils.getSourceFromDescriptor(descriptor);
|
||||
if (element instanceof JetClassOrObject && PsiSearchScopeUtil.isInScope(searchScope, element)) {
|
||||
return (JetClassOrObject) element;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class DeclarationResolver {
|
||||
continue
|
||||
}
|
||||
|
||||
redeclarations.add(Pair(DescriptorToSourceUtils.classDescriptorToDeclaration(descriptor), descriptor.getName()))
|
||||
redeclarations.add(Pair(DescriptorToSourceUtils.getSourceFromDescriptor(descriptor), descriptor.getName()))
|
||||
if (descriptor2 is PropertyDescriptor) {
|
||||
redeclarations.add(Pair(DescriptorToSourceUtils.descriptorToDeclaration(descriptor2), descriptor2.getName()))
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public class DeclarationsChecker {
|
||||
if (conflictingTypes.size() > 1) {
|
||||
DeclarationDescriptor containingDeclaration = typeParameterDescriptor.getContainingDeclaration();
|
||||
assert containingDeclaration instanceof ClassDescriptor : containingDeclaration;
|
||||
JetClassOrObject psiElement = (JetClassOrObject) DescriptorToSourceUtils.classDescriptorToDeclaration(classDescriptor);
|
||||
JetClassOrObject psiElement = (JetClassOrObject) DescriptorToSourceUtils.getSourceFromDescriptor(classDescriptor);
|
||||
JetDelegationSpecifierList delegationSpecifierList = psiElement.getDelegationSpecifierList();
|
||||
assert delegationSpecifierList != null;
|
||||
// trace.getErrorHandler().genericError(delegationSpecifierList.getNode(), "Type parameter " + typeParameterDescriptor.getName() + " of " + containingDeclaration.getName() + " has inconsistent values: " + conflictingTypes);
|
||||
|
||||
@@ -20,7 +20,10 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource;
|
||||
import org.jetbrains.kotlin.descriptors.PropertyAccessorDescriptor;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.resolve.source.SourcePackage;
|
||||
|
||||
@@ -72,11 +75,6 @@ public final class DescriptorToSourceUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiElement classDescriptorToDeclaration(@NotNull ClassDescriptor clazz) {
|
||||
return getSourceFromDescriptor(clazz);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static JetFile getContainingFile(@NotNull DeclarationDescriptor declarationDescriptor) {
|
||||
// declarationDescriptor may describe a synthesized element which doesn't have PSI
|
||||
|
||||
+1
-1
@@ -633,7 +633,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
@NotNull ClassDescriptor classDescriptor,
|
||||
@NotNull ClassDescriptor superclass
|
||||
) {
|
||||
PsiElement psiElement = DescriptorToSourceUtils.classDescriptorToDeclaration(classDescriptor);
|
||||
PsiElement psiElement = DescriptorToSourceUtils.getSourceFromDescriptor(classDescriptor);
|
||||
|
||||
PsiElement elementToMark = null;
|
||||
if (psiElement instanceof JetClassOrObject) {
|
||||
|
||||
@@ -114,7 +114,7 @@ public class JetExpectedResolveDataUtil {
|
||||
ModuleDescriptor module = LazyResolveTestUtil.resolveProject(project);
|
||||
ClassDescriptor classDescriptor = DescriptorUtilPackage.resolveTopLevelClass(module, new FqName(qualifiedName));
|
||||
assertNotNull("Class descriptor wasn't resolved: " + qualifiedName, classDescriptor);
|
||||
PsiClass psiClass = (PsiClass) DescriptorToSourceUtils.classDescriptorToDeclaration(classDescriptor);
|
||||
PsiClass psiClass = (PsiClass) DescriptorToSourceUtils.getSourceFromDescriptor(classDescriptor);
|
||||
assertNotNull("Class declaration wasn't found: " + classDescriptor, psiClass);
|
||||
return psiClass;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user