``` val runBlockingSymbol = pluginContext.r...
# compiler
r
Copy code
val runBlockingSymbol = pluginContext.referenceFunctions(FqName("kotlinx.coroutines.runBlocking"))
            .firstOrNull() ?: return
This API is not supported for K2, is there any other method?
p
You can use
Copy code
fun referenceFunctions(callableId: CallableId): Collection<IrSimpleFunctionSymbol>
instead
r
hey, thanks, but it not work, I cant import this method in the IDEA, I create a class and inherit
IrElementTransformerVoidWithContext
p
It's another method of plugin context. FqName is bad API, which is mixing nested classes with packages, i.e. it can distinglish
runBlocking
topLevel function in
kotlinx.coroutines
package from
runBlocking
method of
coroutines
class within
kotlinx
package. So K2 is used ClassId/CallableId API everywhere instead of FqName. In particular in
pluginContext
there is another method which accepts
CallableId
instead of
FqName
and it works with K2.
r
Oh, i fixed it, this is method's parameter in K2 is CallableId, not FqName