Minor: remove unused parameters, reformat code

This commit is contained in:
Georgy Bronnikov
2020-04-20 20:42:26 +03:00
parent 6372c01e49
commit 82d55e1a67
7 changed files with 15 additions and 16 deletions
@@ -169,7 +169,7 @@ class Fir2IrConverter(
val typeTranslator = TypeTranslator(symbolTable, languageVersionSettings, moduleDescriptor.builtIns)
constantValueGenerator.typeTranslator = typeTranslator
typeTranslator.constantValueGenerator = constantValueGenerator
val builtIns = IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, signaturer, symbolTable)
val builtIns = IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, symbolTable)
val sourceManager = PsiSourceManager()
val components = Fir2IrComponentsStorage(session, scopeSession, symbolTable, builtIns)
val declarationStorage = Fir2IrDeclarationStorage(components, moduleDescriptor)
@@ -56,7 +56,9 @@ object JvmBackendFacade {
val stubGenerator = DeclarationStubGenerator(
psi2irContext.moduleDescriptor, psi2irContext.symbolTable, psi2irContext.irBuiltIns.languageVersionSettings, extensions
)
val irLinker = JvmIrLinker(psi2irContext.moduleDescriptor, EmptyLoggingContext, psi2irContext.irBuiltIns, psi2irContext.symbolTable, stubGenerator, mangler)
val irLinker = JvmIrLinker(
psi2irContext.moduleDescriptor, EmptyLoggingContext, psi2irContext.irBuiltIns, psi2irContext.symbolTable, stubGenerator, mangler
)
val dependencies = psi2irContext.moduleDescriptor.allDependencyModules.map {
val kotlinLibrary = (it.getCapability(KlibModuleOrigin.CAPABILITY) as? DeserializedKlibModuleOrigin)?.library
irLinker.deserializeIrModuleHeader(it, kotlinLibrary)
@@ -65,7 +67,8 @@ object JvmBackendFacade {
stubGenerator.setIrProviders(irProviders)
val irModuleFragment = psi2ir.generateModuleFragment(psi2irContext, files, irProviders, expectDescriptorToSymbol = null, pluginExtensions)
val irModuleFragment =
psi2ir.generateModuleFragment(psi2irContext, files, irProviders, expectDescriptorToSymbol = null, pluginExtensions)
irLinker.postProcess()
stubGenerator.unboundSymbolGeneration = true
@@ -63,7 +63,9 @@ class Psi2IrTranslator(
symbolTable: SymbolTable = SymbolTable(signaturer),
extensions: GeneratorExtensions = GeneratorExtensions()
): GeneratorContext =
createGeneratorContext(configuration, moduleDescriptor, bindingContext, languageVersionSettings, symbolTable, extensions, signaturer)
createGeneratorContext(
configuration, moduleDescriptor, bindingContext, languageVersionSettings, symbolTable, extensions
)
fun generateModuleFragment(
context: GeneratorContext,
@@ -28,8 +28,7 @@ fun createGeneratorContext(
bindingContext: BindingContext,
languageVersionSettings: LanguageVersionSettings,
symbolTable: SymbolTable,
extensions: GeneratorExtensions,
signaturer: IdSignatureComposer
extensions: GeneratorExtensions
): GeneratorContext {
val typeTranslator = TypeTranslator(symbolTable, languageVersionSettings, builtIns = moduleDescriptor.builtIns)
val constantValueGenerator = ConstantValueGenerator(moduleDescriptor, symbolTable)
@@ -44,7 +43,7 @@ fun createGeneratorContext(
extensions,
typeTranslator,
constantValueGenerator,
IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, signaturer, symbolTable)
IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, symbolTable)
)
}
@@ -36,15 +36,12 @@ import org.jetbrains.kotlin.types.*
class IrBuiltIns(
val builtIns: KotlinBuiltIns,
private val typeTranslator: TypeTranslator,
signaturer: IdSignatureComposer,
outerSymbolTable: SymbolTable? = null
private val symbolTable: SymbolTable
) {
val languageVersionSettings = typeTranslator.languageVersionSettings
private val builtInsModule = builtIns.builtInsModule
private val symbolTable = outerSymbolTable ?: SymbolTable(signaturer)
private val packageFragmentDescriptor = IrBuiltinsPackageFragmentDescriptorImpl(builtInsModule, KOTLIN_INTERNAL_IR_FQN)
val packageFragment =
IrExternalPackageFragmentImpl(symbolTable.referenceExternalPackageFragment(packageFragmentDescriptor), KOTLIN_INTERNAL_IR_FQN)
@@ -229,7 +229,7 @@ fun loadIr(
)
typeTranslator.constantValueGenerator = constantValueGenerator
constantValueGenerator.typeTranslator = typeTranslator
val irBuiltIns = IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, signaturer, symbolTable)
val irBuiltIns = IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, symbolTable)
val irLinker = JsIrLinker(null, emptyLoggingContext, irBuiltIns, symbolTable, null)
val deserializedModuleFragments = sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map {
@@ -264,8 +264,7 @@ private fun runAnalysisAndPreparePsi2Ir(depsDescriptors: ModulesStructure): Gene
analysisResult.bindingContext,
depsDescriptors.compilerConfiguration.languageVersionSettings,
SymbolTable(signaturer),
GeneratorExtensions(),
signaturer
GeneratorExtensions()
)
}
@@ -48,8 +48,7 @@ class JsScriptDependencyCompiler(
it.constantValueGenerator = ConstantValueGenerator(moduleDescriptor, symbolTable)
}
val signaturer = IdSignatureDescriptor(JsManglerDesc)
val irBuiltIns = IrBuiltIns(builtIns, typeTranslator, signaturer, symbolTable)
val irBuiltIns = IrBuiltIns(builtIns, typeTranslator, symbolTable)
val jsLinker = JsIrLinker(null, emptyLoggingContext, irBuiltIns, symbolTable, null)
val moduleFragment = IrModuleFragmentImpl(moduleDescriptor, irBuiltIns)