Fix "kotlin.UninitializedPropertyAccessException: lateinit property typeTranslator has not been initialized" in Native IR serialization plugin

This commit is contained in:
Leonid Startsev
2018-11-22 17:05:00 +03:00
parent 7c8b34fe1c
commit f13f54d5ad
@@ -45,9 +45,10 @@ import org.jetbrains.kotlinx.serialization.compiler.resolve.*
val BackendContext.externalSymbols: ReferenceSymbolTable get() = ir.symbols.externalSymbolTable val BackendContext.externalSymbols: ReferenceSymbolTable get() = ir.symbols.externalSymbolTable
internal fun BackendContext.createTypeTranslator(moduleDescriptor: ModuleDescriptor): TypeTranslator = internal fun BackendContext.createTypeTranslator(moduleDescriptor: ModuleDescriptor): TypeTranslator =
TypeTranslator(externalSymbols, irBuiltIns.languageVersionSettings).apply { TypeTranslator(externalSymbols, irBuiltIns.languageVersionSettings).apply {
constantValueGenerator = ConstantValueGenerator(moduleDescriptor, symbolTable = externalSymbols) constantValueGenerator = ConstantValueGenerator(moduleDescriptor, symbolTable = externalSymbols)
} constantValueGenerator.typeTranslator = this
}
interface IrBuilderExtension { interface IrBuilderExtension {
val compilerContext: BackendContext val compilerContext: BackendContext