Removed the lazy class hack for the hierarchy based isObjCClass.

Renamed name clashed signature based version of isObjCClass to hasInteropSuperClass

(cherry picked from commit 7feb1dcc3d3a7b8aa0ec606c7966af2733fe1734)
This commit is contained in:
Alexander Gorshenev
2020-06-28 23:53:07 +03:00
committed by Vasily Levchenko
parent ecf27d4dc2
commit e64cf2b6f4
@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl
import org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl
import org.jetbrains.kotlin.ir.declarations.impl.IrModuleFragmentImpl
import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyClass
import org.jetbrains.kotlin.ir.descriptors.IrAbstractFunctionFactory
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
import org.jetbrains.kotlin.ir.symbols.IrSymbol
@@ -54,13 +53,13 @@ object KonanFakeOverrideClassFilter : PlatformFakeOverrideClassFilter {
// This is an alternative to .isObjCClass that doesn't need to walk up all the class heirarchy,
// rather it only looks at immediate super class symbols.
private fun IrClass.isObjCClass() = this.superTypes
private fun IrClass.hasInteropSuperClass() = this.superTypes
.mapNotNull { it.classOrNull }
.filter { it is IrPublicSymbolBase<*> }
.any { it.signature.isInteropSignature() }
override fun constructFakeOverrides(clazz: IrClass): Boolean {
return !clazz.isObjCClass()
return !clazz.hasInteropSuperClass()
}
}
@@ -152,19 +151,6 @@ internal class KonanIrLinker(
val symbolOwner = stubGenerator.generateMemberStub(descriptor) as IrSymbolOwner
// Make sure all class hierarchy is available, otherwise we won't be able
// to build fake overrides.
// TODO: we actually only need it to tell if class .isObjCClass
// So if we could come up with a way to tell without looking at class hierarchy
// this hack could be erased.
if (symbolOwner is IrLazyClass) {
symbolOwner.superTypes.forEach {
it.classOrNull?.let {
symbolTable.referenceClassFromLinker(it.descriptor, it.signature)
}
}
}
return symbolOwner.symbol
}