FIR2IR/MPP: use single SymbolTable during MPP compilation

This commit is contained in:
Mikhail Glukhikh
2023-01-11 14:13:58 +01:00
committed by Space Team
parent 33daca6809
commit 890e3d1c10
9 changed files with 58 additions and 23 deletions
@@ -127,7 +127,8 @@ fun AbstractFirAnalyzerFacade.convertToJsIr(
irGeneratorExtensions,
generateSignatures = false,
kotlinBuiltIns = builtIns ?: DefaultBuiltIns.Instance, // TODO: consider passing externally,
dependentComponents = emptyList()
dependentComponents = emptyList(),
currentSymbolTable = null
).also {
(it.irModuleFragment.descriptor as? FirModuleDescriptor)?.let { it.allDependencyModules = dependencies }
}
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.fir.backend.jvm.FirJvmBackendExtension
import org.jetbrains.kotlin.fir.backend.jvm.JvmFir2IrExtensions
import org.jetbrains.kotlin.fir.psi
import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmIrMangler
import org.jetbrains.kotlin.ir.util.SymbolTable
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.CompilerEnvironment
import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProviderFactory
@@ -67,6 +68,7 @@ class Fir2IrResultsConverter(
val dependentIrParts = mutableListOf<JvmIrCodegenFactory.JvmIrBackendInput>()
lateinit var mainIrPart: JvmIrCodegenFactory.JvmIrBackendInput
var currentSymbolTable: SymbolTable? = null
for ((index, firOutputPart) in inputArtifact.partsForDependsOnModules.withIndex()) {
val dependentComponents = mutableListOf<Fir2IrComponents>()
if (isMppSupported) {
@@ -75,7 +77,10 @@ class Fir2IrResultsConverter(
}
}
val (irModuleFragment, components, pluginContext) = firOutputPart.firAnalyzerFacade.convertToIr(fir2IrExtensions, dependentComponents)
val (irModuleFragment, components, pluginContext) = firOutputPart.firAnalyzerFacade.convertToIr(
fir2IrExtensions, dependentComponents, currentSymbolTable
)
currentSymbolTable = components.symbolTable
componentsMap[firOutputPart.module.name] = components
val irPart = JvmIrCodegenFactory.JvmIrBackendInput(