[IR] Move coroutine-related helpers to a more appropriate place

The `isBuiltInSuspendCoroutine` and
`isBuiltInSuspendCoroutineUninterceptedOrReturn` helpers are not
inherently related to function inlining.
This commit is contained in:
Sergej Jaskiewicz
2024-02-05 13:46:34 +01:00
committed by Space Team
parent 919abe483a
commit acee8da283
4 changed files with 14 additions and 16 deletions
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.ir.util
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.ir.*
import org.jetbrains.kotlin.ir.declarations.*
@@ -324,3 +325,12 @@ fun IrClassSymbol.getPropertySetter(name: String): IrSimpleFunctionSymbol? = own
fun filterOutAnnotations(fqName: FqName, annotations: List<IrConstructorCall>): List<IrConstructorCall> {
return annotations.filterNot { it.annotationClass.hasEqualFqName(fqName) }
}
fun IrFunction.isBuiltInSuspendCoroutine(): Boolean =
isTopLevelInPackage("suspendCoroutine", StandardNames.COROUTINES_PACKAGE_FQ_NAME)
fun IrFunction.isBuiltInSuspendCoroutineUninterceptedOrReturn(): Boolean =
isTopLevelInPackage(
"suspendCoroutineUninterceptedOrReturn",
StandardNames.COROUTINES_INTRINSICS_PACKAGE_FQ_NAME
)