I'd like to delegate to some automation some addit...
# compiler
e
I'd like to delegate to some automation some additional code in order to dispose efficiently some resources which do not escape the scope of a function, that is they are local to the function. Annotation processor seems to be able to only generate new source code.. would a compiler plugin be able to modify existing source code instead?
r
Hi @elect, a compiler plugin can modify declarations and expressions in function bodies. Normally this is done at the codegen IR phase and changes you make are not visible in IDEA. Maybe in the future when the FIR api for compiler plugins is ready you may be able to perform body transformations that are visible also in the Kotlin IDEA plugin.
e
I may accept that for the time being.. One question though, how debugging is affected?
I refer, for example, to the
@DebugLog
example. If the plugin injects other code, what will the use see during debugging?
e
probably a "Source code does not match the bytecode" warning in the IDE, I would guess
👍 1
e
@raulraja what's the status with Arrow Meta and the new compiler?
r
we are developing plugins for data flow analysis and implicit resolution, other than that waiting on FIR and the compiler plugin api to become stable to offer a version of the Quote system based on the FIR model. I hope sometime in 1.6.x or .17.x we have a stable release of meta
👍 1