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:
Denis Zharkov
2018-12-14 13:11:14 +03:00
parent 9736975d52
commit 5cc242e878
5 changed files with 21 additions and 21 deletions
@@ -153,19 +153,19 @@ private fun <Signature> findSuperImplementationForStubDelegation(
areDeclarationAndDefinitionSame: (CallableMemberDescriptor) -> Boolean,
signatureByDescriptor: (FunctionDescriptor) -> Signature
): FunctionDescriptor? {
val implementation = findConcreteSuperDeclaration(DescriptorBasedFunctionHandle(function, areDeclarationAndDefinitionSame)).descriptor
val implementation = findConcreteSuperDeclaration(DescriptorBasedFunctionHandle(function, areDeclarationAndDefinitionSame))
// Implementation from interface will be generated by common mechanism
if (DescriptorUtils.isInterface(implementation.containingDeclaration)) return null
if (!implementation.mayBeUsedAsSuperImplementation) return null
// Implementation in super-class already has proper signature
if (signatureByDescriptor(function) == signatureByDescriptor(implementation)) return null
if (signatureByDescriptor(function) == signatureByDescriptor(implementation.descriptor)) return null
assert(function.modality == Modality.OPEN) {
"Should generate stubs only for non-abstract built-ins, but ${function.name} is ${function.modality}"
}
return implementation
return implementation.descriptor
}
private fun findAllReachableDeclarations(