Chachako
12/28/2021, 2:59 PMIrGenerationExtension
to process all files, then access all expressions through IrElementTransformer
, then find out the corresponding references and replace them, but I’m a little worried about its performance.
I would be grateful if someone could give me a some advice! 🙏🏻Chachako
12/28/2021, 3:02 PMIrElementTransformer
to implement this, how should I highlight them in the IDEA? There is currently no IR in IDEAmcpiroman
12/28/2021, 3:24 PMuseYup, that's how you do it, that's how the compiler does it either, many many times. As to performance, I do argue this is may not be the very most optimal way in general, but as for a usage in plugin you should not notice any problem (not even difference), unless you do many such passes.to process all files, then access all expressions throughIrGenerationExtension
, then find out the corresponding references and replace themIrElementTransformer
mcpiroman
12/28/2021, 3:30 PMhow should I highlight them in the IDEA? There is currently no IR in IDEAYou can't. IR by it's principle has, nothing to do with IDE. What you do here is a backend plugin. There is also a concept of frontend plugins, which are under development and will be usable with the new FIR frontend, but AFAIK not soon. These, along with Kotlin IDEA plugin might allow to do that, but I don't know.
Chachako
12/29/2021, 2:49 PMChachako
12/29/2021, 4:32 PMYou can’t. IR by it’s principle has, nothing to do with IDE.So would it be better if I found all the calls in advance through the
AnalysisHandlerExtension
? In this way, it can share code with the idea, but it is a little difficult to turn KtElement
into IrElement
🥲