Hello, I am trying to produce IR using kotlin-compiler-embeddable:1.4.0, I am trying to create Psi2IrTranslator, but for some reason in embeddable compiler it requires IdSignatureComposer instance, even though in kotlin master branch Psi2IrTranslator doesn’t. Implementation search doesn’t work, so can anyone please tell me default implementation of IdSignatureComposer so I can try out the new IR as quickly as possible?
Thank you for any support in advance!
My code is:
fun main(args: Array<String>) {
val configuration = CompilerConfiguration()
configuration.put(CommonConfigurationKeys.USE_FIR, true)
configuration.put(CommonConfigurationKeys.MODULE_NAME, "test")
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, GroupingMessageCollector(
PrintingMessageCollector(System.out, MessageRenderer.PLAIN_RELATIVE_PATHS, true), false)
)
val environment = KotlinCoreEnvironment.createForProduction(
Disposable { },
configuration,
EnvironmentConfigFiles.JVM_CONFIG_FILES
)
val files = listOf(File("src/test.main/kotlin/Test.kt"))
environment.addKotlinSourceRoots(files)
val result = TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
environment.project,
environment.getSourceFiles(),
CliBindingTrace(),
configuration,
environment::createPackagePartProvider
)
val state = GenerationState.Builder(
environment.project,
ClassBuilderFactories.BINARIES,
result.moduleDescriptor,
result.bindingContext,
environment.getSourceFiles(),
configuration
).build()
val extensions = JvmGeneratorExtensions()
val psi2ir = Psi2IrTranslator(state.languageVersionSettings, Psi2IrConfiguration(), object : IdSignatureComposer {
override fun composeEnumEntrySignature(descriptor: ClassDescriptor): IdSignature? {
TODO("Not yet implemented")
}
override fun composeSignature(descriptor: DeclarationDescriptor): IdSignature? {
TODO("Not yet implemented")
}
})
val psi2irContext = psi2ir.createGeneratorContext(state.module, state.bindingContext, extensions = extensions)
var irModuleFragment = psi2ir.generateModule(result.moduleDescriptor, environment.getSourceFiles(), result.bindingContext, extensions)
}