I need a suggestion on K1->K2 Kotlin compiler plugin migration.
I have a K1-compatible plugin that overrides AnalysisHandlerExtension::analysisCompleted and uses a bindingContext to get a slice of TYPEs used in compilation:
bindingContext.getSliceContents(BindingContext.TYPE)
Full K1 plugin code snippet:
class Ext: AnalysisHandlerExtension {
override fun analysisCompleted(
project: Project,
module: ModuleDescriptor,
bindingTrace: BindingTrace,
files: Collection<KtFile>
): AnalysisResult? {
...
bindingTrace.bindingContext.getSliceContents(BindingContext.TYPE).values.forEach {
record(it)
}
...
}
Question
What is the most appropriate way to implement it using K2?
We likely need two things: first, an analysisCompleted analogue, and second, a bindingContext.getSliceContents analogue. Any suggestions?