Hiii, I'm a complete noob about "compiler plugins"...
# compiler
r
Hiii, I'm a complete noob about "compiler plugins". I'd like to know if my annotation for searching within the compiler is used in a suspend function or an inline function. Will my plugin find original data from the source code or will it all already be inline and transformed? Are there any utilities for working with suspend or inline within the compiler plugin?
c
The Kotlin compiler is separated into two big phases: frontend (FIR) and backend (IR) compilation. Frontend should have everything as-is without any inlining. You can find all uses of your annotations with the way described here: https://github.com/JetBrains/kotlin/blob/master/docs/fir/fir-plugins.md I don't actually know where you use the method it describes, but it's there I guess?
EDIT: The "DSL" it describes (
annotated(...)
, etc.) is inside a
LookupPredicate.create { }
or
DeclarationPredicate.create { }
block. You save those predicates as fields in your FirExtensionSessionComponent (colloquially known as your "service"), then use them in methods on
session.predicateBasedProvider
to query for those things.