dimitar_
05/13/2021, 4:17 PMprintln("I'm here");
I can compile the class and when I try to use kotlinc
to compile another class that calls the generated function, I get:
kotlinc -classpath . test.kt
test.kt:2:10: error: unresolved reference: generatedFunction
Main().generatedFunction()
But when I do the same with javac
, everything is ok.
I can also run the class and I get the desired output
java Test
I'm here
Any pointers would be highly appreciated 🙂
p.s. Is there any documentation about writing compiler plugins with IR out there?rnett
05/13/2021, 8:57 PMdimitar_
05/13/2021, 9:00 PMrnett
05/13/2021, 9:00 PMfun generatedFunction() = error("")
and replacing the body in IR, or use SyntheticResolveExtension (I forget the exact name, it might be SyntheticResolutionExtension).dimitar_
05/13/2021, 9:01 PMrnett
05/13/2021, 9:04 PMdimitar_
05/13/2021, 9:06 PMdimitar_
05/14/2021, 6:28 PMSyntheticResolveExtension
and generate a new synthetic method. And then in the IrGenerationExtension
I generate the body of the function and it works great!
Thanks!dimitar_
05/14/2021, 6:52 PMrnett
05/14/2021, 7:51 PMSyntheticResolveExtension
. The full docs are [here](https://plugins.jetbrains.com/docs/intellij/welcome.html) but that's mostly irreverent to you. If I remember right you just need a gradle module w/ the right setup and a xml file that registers your SyntheticResolveExtension
(presumably by depending on your compiler plugin).dimitar_
05/14/2021, 8:07 PM