Refactor FunctionHandle::isInterfaceDeclaration
- Give it more clear name mayBeUsedAsSuperImplementation because defining if it can be used as super-implementation this is what it used for - The meaning is negated, so it's needed to negate its usages and impls - Also, reuse it in findSuperImplementationForStubDelegation
This commit is contained in:
@@ -27,7 +27,7 @@ interface FunctionHandle {
|
||||
* class ones (see [findConcreteSuperDeclaration] method in bridges.kt).
|
||||
* Note that interface methods with body compiled to jvm 8 target are assumed to be non-abstract in bridges method calculation
|
||||
* (more details in [DescriptorBasedFunctionHandle.isBodyOwner] comment).*/
|
||||
val isInterfaceDeclaration: Boolean
|
||||
val mayBeUsedAsSuperImplementation: Boolean
|
||||
|
||||
fun getOverridden(): Iterable<FunctionHandle>
|
||||
}
|
||||
@@ -114,7 +114,7 @@ fun <Function : FunctionHandle> findConcreteSuperDeclaration(function: Function)
|
||||
}
|
||||
result.removeAll(toRemove)
|
||||
|
||||
val concreteRelevantDeclarations = result.filter { !it.isAbstract && !it.isInterfaceDeclaration }
|
||||
val concreteRelevantDeclarations = result.filter { !it.isAbstract && it.mayBeUsedAsSuperImplementation }
|
||||
if (concreteRelevantDeclarations.size != 1) {
|
||||
error("Concrete fake override $function should have exactly one concrete super-declaration: $concreteRelevantDeclarations")
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ class DescriptorBasedFunctionHandle(
|
||||
override val isAbstract: Boolean =
|
||||
descriptor.modality == Modality.ABSTRACT || !areDeclarationAndDefinitionSame(descriptor)
|
||||
|
||||
override val isInterfaceDeclaration: Boolean
|
||||
get() = DescriptorUtils.isInterface(descriptor.containingDeclaration)
|
||||
override val mayBeUsedAsSuperImplementation: Boolean =
|
||||
!DescriptorUtils.isInterface(descriptor.containingDeclaration)
|
||||
|
||||
override fun getOverridden() = overridden
|
||||
|
||||
|
||||
Reference in New Issue
Block a user