Add location parameter to DescriptorUtils#getInnerClassByName
This commit is contained in:
@@ -511,14 +511,14 @@ public class KotlinBuiltIns {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getMapEntry() {
|
public ClassDescriptor getMapEntry() {
|
||||||
ClassDescriptor classDescriptor = DescriptorUtils.getInnerClassByName(getMap(), "Entry");
|
ClassDescriptor classDescriptor = DescriptorUtils.getInnerClassByName(getMap(), "Entry", NoLookupLocation.FROM_BUILTINS);
|
||||||
assert classDescriptor != null : "Can't find Map.Entry";
|
assert classDescriptor != null : "Can't find Map.Entry";
|
||||||
return classDescriptor;
|
return classDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getMutableMapEntry() {
|
public ClassDescriptor getMutableMapEntry() {
|
||||||
ClassDescriptor classDescriptor = DescriptorUtils.getInnerClassByName(getMutableMap(), "MutableEntry");
|
ClassDescriptor classDescriptor = DescriptorUtils.getInnerClassByName(getMutableMap(), "MutableEntry", NoLookupLocation.FROM_BUILTINS);
|
||||||
assert classDescriptor != null : "Can't find MutableMap.MutableEntry";
|
assert classDescriptor != null : "Can't find MutableMap.MutableEntry";
|
||||||
return classDescriptor;
|
return classDescriptor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
|
|||||||
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
|
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
|
||||||
import org.jetbrains.kotlin.descriptors.impl.FunctionExpressionDescriptor;
|
import org.jetbrains.kotlin.descriptors.impl.FunctionExpressionDescriptor;
|
||||||
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl;
|
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl;
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
import org.jetbrains.kotlin.incremental.components.LookupLocation;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.name.FqNameUnsafe;
|
import org.jetbrains.kotlin.name.FqNameUnsafe;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
@@ -389,10 +389,11 @@ public class DescriptorUtils {
|
|||||||
return Visibilities.PUBLIC;
|
return Visibilities.PUBLIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: should be internal
|
||||||
@Nullable
|
@Nullable
|
||||||
public static ClassDescriptor getInnerClassByName(@NotNull ClassDescriptor classDescriptor, @NotNull String innerClassName) {
|
public static ClassDescriptor getInnerClassByName(@NotNull ClassDescriptor classDescriptor, @NotNull String innerClassName, @NotNull LookupLocation location) {
|
||||||
ClassifierDescriptor classifier =
|
ClassifierDescriptor classifier =
|
||||||
classDescriptor.getDefaultType().getMemberScope().getClassifier(Name.identifier(innerClassName), NoLookupLocation.UNSORTED);
|
classDescriptor.getDefaultType().getMemberScope().getClassifier(Name.identifier(innerClassName), location);
|
||||||
assert classifier instanceof ClassDescriptor :
|
assert classifier instanceof ClassDescriptor :
|
||||||
"Inner class " + innerClassName + " in " + classDescriptor + " should be instance of ClassDescriptor, but was: "
|
"Inner class " + innerClassName + " in " + classDescriptor + " should be instance of ClassDescriptor, but was: "
|
||||||
+ (classifier == null ? "null" : classifier.getClass());
|
+ (classifier == null ? "null" : classifier.getClass());
|
||||||
|
|||||||
Reference in New Issue
Block a user