Made code more clear
This commit is contained in:
@@ -45,15 +45,15 @@ public fun DeclarationDescriptor.canBeReferencedViaImport(): Boolean {
|
|||||||
(this is CallableDescriptor && DescriptorUtils.isStaticDeclaration(this))) {
|
(this is CallableDescriptor && DescriptorUtils.isStaticDeclaration(this))) {
|
||||||
return !getName().isSpecial()
|
return !getName().isSpecial()
|
||||||
}
|
}
|
||||||
val parent = getContainingDeclaration()!!
|
|
||||||
if (parent !is ClassDescriptor || !parent.canBeReferencedViaImport()) {
|
val parentClass = getContainingDeclaration() as? ClassDescriptor ?: return false
|
||||||
return false
|
if (!parentClass.canBeReferencedViaImport()) return false
|
||||||
|
|
||||||
|
return when (this) {
|
||||||
|
is ConstructorDescriptor -> !parentClass.isInner() // inner class constructors can't be referenced via import
|
||||||
|
is ClassDescriptor -> true
|
||||||
|
else -> false
|
||||||
}
|
}
|
||||||
// inner class constructors can't be referenced via import
|
|
||||||
if (this is ConstructorDescriptor && parent.isInner()) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return this is ClassDescriptor || this is ConstructorDescriptor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun JetType.canBeReferencedViaImport(): Boolean {
|
public fun JetType.canBeReferencedViaImport(): Boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user