Hi, I'm new to compiler plugins. I don't know where to start.
I want to append a function parameter at start, replace a field usage to use that parameter, a little bit like compose's plugin.
For example:
Copy code
const val processor: Processor get() = throw RuntimeException("Should replaced by compiler plugin")
Original code:
Copy code
fun apiCall(p0: Int) {
processor.something(p0)
}
fun main() {
apiCall(123)
}
Would become:
Copy code
fun apiCall(p0: Int) {
processor.something(p0)
}
fun main() {
Processor().use { processor ->
// old main's entire body
apiCall(processor, 123)
}
}
Where should I start? What level does this belongs to? What are some related classes/function will be used, so I can look into?