IR: simplify initialization cycle of TypeTranslator/ConstantValueGenerator

This commit is contained in:
Alexander Udalov
2021-02-21 15:01:06 +01:00
parent 5ea3d32b98
commit d991a3e40f
9 changed files with 18 additions and 59 deletions
@@ -193,20 +193,15 @@ private fun getIrMethodSymbolByName(methodName: String): String {
}
private fun getIrBuiltIns(): IrBuiltIns {
val builtIns = DefaultBuiltIns.Instance
val languageSettings = LanguageVersionSettingsImpl(LanguageVersion.KOTLIN_1_3, ApiVersion.KOTLIN_1_3)
val moduleDescriptor = ModuleDescriptorImpl(Name.special("<test-module>"), LockBasedStorageManager(""), builtIns)
val moduleDescriptor = ModuleDescriptorImpl(Name.special("<test-module>"), LockBasedStorageManager(""), DefaultBuiltIns.Instance)
val signaturer = object : IdSignatureComposer {
override fun composeSignature(descriptor: DeclarationDescriptor): IdSignature? = null
override fun composeEnumEntrySignature(descriptor: ClassDescriptor): IdSignature? = null
}
val symbolTable = SymbolTable(signaturer, IrFactoryImpl)
val constantValueGenerator = ConstantValueGenerator(moduleDescriptor, symbolTable)
val typeTranslator = TypeTranslator(symbolTable, languageSettings, builtIns)
constantValueGenerator.typeTranslator = typeTranslator
typeTranslator.constantValueGenerator = constantValueGenerator
return IrBuiltIns(builtIns, typeTranslator, symbolTable)
val typeTranslator = TypeTranslator(symbolTable, languageSettings, moduleDescriptor)
return IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, symbolTable)
}