Drew Hamilton
05/19/2023, 11:08 PMirCall
, like how data classes have generated calls to their properties’ hashCode functions. Is it possible to generate a call to an arbitrary function that you don’t have a direct reference to, like a kotlin-stdlib-common
function?Tóth István Zoltán
05/20/2023, 8:30 AMreferenceClass
. Note, that referenceClass
is a "FIR incompatible API" whatever that means at the moment. They might change it, but I guess a similar functionality will be added as it would be nigh impossible to write the compiler without it.
I'm nowhere close to a JB official, so this information is just what I've gathered by reading other plugins and the compiler code. Take it with a bit of salt.
As for the call itself, it is pretty simple, just search the plugin code for irCall
or IrCallImpl
.
Pay attention to the dispatch receivers, those are really deep rabbit holes I've fallen into again and again.
https://github.com/spxbhuhb/rui/blob/2f1204101c32f952dc7e833df7acbe355ab639c2/rui-[…]n/kotlin/hu/simplexion/rui/kotlin/plugin/ir/RuiPluginContext.ktdmitriy.novozhilov
05/20/2023, 8:34 AMTóth István Zoltán
05/20/2023, 8:42 AMDrew Hamilton
05/23/2023, 11:26 PM