I’m curious about how the kotlin compiler works with coroutines. Currently I’m looking the official kotlin repository(https://github.com/JetBrains/kotlin), but there are a lot of modules and it’s hard to figure out where to start. Could you guys give me some guidance?
➕ 1
r
raulraja
02/26/2020, 9:47 AM
Coroutines is a library. Try searching for suspend in the compiler. Coroutines and other libs are built on top of suspend providing a runtime implementing startCoroutine... Methods published in the suspend intrinsics of the std lib
raulraja
02/26/2020, 9:48 AM
Suspend functions are translated into Function2 with an extra Continuation argument
raulraja
02/26/2020, 9:49 AM
The compiler also controls restricted suspension over receivers
raulraja
02/26/2020, 9:50 AM
There are psi, descriptors, utilities and pretty much presence of suspension related stuff everywhere including the idea plugin for Kotlin
raulraja
02/26/2020, 9:50 AM
What is it that you are trying to accomplish? I may be able to point you to the right place since I've looked into this before
t
turastory
02/27/2020, 1:35 AM
I have no special purpose now. Just for satisfying my own curiosity. I’ll look into it based on your comments. Thank you! simple smilearrow