I am trying to implement a compiler plugin by conn...
# compiler
b
I am trying to implement a compiler plugin by connecting to the FIR instead of IR, the way
AllOpenVisibilityTransformer
is a
DeclarationAttributeAltererExtension
. But it looks like All Open only works because
DeclarationAttributeAltererExtension
is registered in KotlinCoreEnvironment. I'm wondering if there's a way for a user to register a plugin extension point, or if it's gotta go into
KotlinCoreEnvironment
, meaning making changes to the compiler itself? For the latter, I'd just want to add a few more methods to
DeclarationAttributeAltererExtension
so it could do more than change modality, specifically, changing visibility through a compiler plugin.
d
AllOpenVisibilityTransformer
is a very early prototype made as proof of concept of extension API of FIR. That prototype showed to us some disadvantages of that API (in part of creating new declarations), so we gonna to change it (but only after FIR came to alpha stage). Also there are multiple of unresolved problems, like how to plugin developer should generate bodies of declarations, created by plugin (on FIR stage, on IR, something else) So actually there is no legal way to register FIR plugin, but when it will be done in some state we will announce it, so compiler plugin devs can give us feedback (because we really want to create good compiler API, which won't be similar to existed dirty one)
If you want just to experiment with FIR compiler API, then the only way to do it is fork kotlin project and write some experiments somewhere around
AllOpenVisibilityTransformer
(I can give more detailed instructions, if you want)