IR: refactor resolveFakeOverride call sites
Split it to 4 functions for clarity: resolveFakeOverride, resolveFakeOverrideOrFail, resolveFakeOverrideMaybeAbstract, resolveFakeOverrideMaybeAbstractOrFail. Remove/inline duplicated utilities and remove unused parameters.
This commit is contained in:
committed by
Space Team
parent
e52529a1d1
commit
b5ba9ee671
+1
-1
@@ -307,7 +307,7 @@ internal fun KotlinStubs.generateObjCCall(
|
||||
receiver: ObjCCallReceiver,
|
||||
arguments: List<IrExpression?>
|
||||
) = builder.irBlock {
|
||||
val resolved = method.resolveFakeOverride(allowAbstract = true)?: method
|
||||
val resolved = method.resolveFakeOverrideMaybeAbstract() ?: method
|
||||
val isDirect = directSymbolName != null
|
||||
|
||||
val exceptionMode = ForeignExceptionMode.byValue(
|
||||
|
||||
+1
-1
@@ -306,7 +306,7 @@ internal object VirtualTablesLookup {
|
||||
}
|
||||
|
||||
internal fun IrSimpleFunction.findOverriddenMethodOfAny() =
|
||||
resolveFakeOverride(allowAbstract = false).takeIf { it?.parentClassOrNull?.isAny() == true }
|
||||
resolveFakeOverride().takeIf { it?.parentClassOrNull?.isAny() == true }
|
||||
|
||||
/*
|
||||
* Special trampoline function to call actual virtual implementation. This helps with reducing
|
||||
|
||||
+1
-1
@@ -1533,7 +1533,7 @@ private fun ObjCExportCodeGenerator.itablePlace(irFunction: IrSimpleFunction): C
|
||||
assert(irFunction.isOverridable)
|
||||
val irClass = irFunction.parentAsClass
|
||||
return if (irClass.isInterface
|
||||
&& (irFunction.isReal || irFunction.resolveFakeOverride(allowAbstract = true)?.parent != context.irBuiltIns.anyClass.owner)
|
||||
&& (irFunction.isReal || irFunction.resolveFakeOverrideMaybeAbstract()?.parent != context.irBuiltIns.anyClass.owner)
|
||||
) {
|
||||
context.getLayoutBuilder(irClass).itablePlace(irFunction)
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -1088,7 +1088,7 @@ private class InteropTransformer(
|
||||
builder.at(expression)
|
||||
val function = expression.symbol.owner
|
||||
|
||||
if ((function as? IrSimpleFunction)?.resolveFakeOverride(allowAbstract = true)?.symbol
|
||||
if ((function as? IrSimpleFunction)?.resolveFakeOverrideMaybeAbstract()?.symbol
|
||||
== symbols.interopNativePointedRawPtrGetter) {
|
||||
|
||||
// Replace by the intrinsic call to be handled by code generator:
|
||||
|
||||
Reference in New Issue
Block a user