[IR] Forbid to use shouldExcludeFunctionFromInlining as public API
#KT-64807
This commit is contained in:
@@ -40,10 +40,11 @@ import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
|
||||
abstract class InlineFunctionResolver {
|
||||
open fun getFunctionDeclaration(symbol: IrFunctionSymbol): IrFunction? {
|
||||
if (shouldExcludeFunctionFromInlining(symbol)) return null
|
||||
return symbol.owner
|
||||
}
|
||||
|
||||
open fun shouldExcludeFunctionFromInlining(symbol: IrFunctionSymbol): Boolean {
|
||||
protected open fun shouldExcludeFunctionFromInlining(symbol: IrFunctionSymbol): Boolean {
|
||||
return Symbols.isLateinitIsInitializedPropertyGetter(symbol) || Symbols.isTypeOfIntrinsic(symbol)
|
||||
}
|
||||
|
||||
@@ -60,7 +61,7 @@ fun IrFunction.isBuiltInSuspendCoroutineUninterceptedOrReturn(): Boolean =
|
||||
|
||||
open class InlineFunctionResolverReplacingCoroutineIntrinsics(open val context: CommonBackendContext) : InlineFunctionResolver() {
|
||||
override fun getFunctionDeclaration(symbol: IrFunctionSymbol): IrFunction? {
|
||||
val function = symbol.owner
|
||||
val function = super.getFunctionDeclaration(symbol) ?: return null
|
||||
// TODO: Remove these hacks when coroutine intrinsics are fixed.
|
||||
return when {
|
||||
function.isBuiltInSuspendCoroutineUninterceptedOrReturn() ->
|
||||
@@ -104,7 +105,7 @@ class FunctionInlining(
|
||||
is IrConstructorCall -> expression.symbol.owner
|
||||
else -> return expression
|
||||
}
|
||||
if (!callee.needsInlining || inlineFunctionResolver.shouldExcludeFunctionFromInlining(callee.symbol))
|
||||
if (!callee.needsInlining)
|
||||
return expression
|
||||
|
||||
val target = (callee as? IrSimpleFunction)?.resolveFakeOverride() ?: callee
|
||||
|
||||
Reference in New Issue
Block a user