[Psi2Ir] Move to new linkage scheme based on IdSignature

Now SymbolTable operates with two types of symbols (public and private)
In case of Public symbol IdSignature is used as table key
Private one uses descriptor as the key in similar scheme as before
This commit is contained in:
Roman Artemev
2020-01-27 16:10:26 +03:00
committed by romanart
parent df7b7cf61a
commit 31d73c5d79
17 changed files with 433 additions and 206 deletions
@@ -24,15 +24,16 @@ object Fir2IrConverter {
session: FirSession,
firFiles: List<FirFile>,
languageVersionSettings: LanguageVersionSettings,
fakeOverrideMode: FakeOverrideMode = FakeOverrideMode.NORMAL
fakeOverrideMode: FakeOverrideMode = FakeOverrideMode.NORMAL,
signaturer: IdSignatureComposer
): Fir2IrResult {
val moduleDescriptor = FirModuleDescriptor(session)
val symbolTable = SymbolTable()
val symbolTable = SymbolTable(signaturer)
val constantValueGenerator = ConstantValueGenerator(moduleDescriptor, symbolTable)
val typeTranslator = TypeTranslator(symbolTable, languageVersionSettings, moduleDescriptor.builtIns)
constantValueGenerator.typeTranslator = typeTranslator
typeTranslator.constantValueGenerator = constantValueGenerator
val builtIns = IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, symbolTable)
val builtIns = IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, signaturer, symbolTable)
val sourceManager = PsiSourceManager()
val fir2irTransformer = Fir2IrVisitor(session, moduleDescriptor, symbolTable, sourceManager, builtIns, fakeOverrideMode)
val irFiles = mutableListOf<IrFile>()
@@ -11,6 +11,8 @@ import com.intellij.psi.PsiElementFinder
import com.intellij.psi.search.GlobalSearchScope
import junit.framework.TestCase
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureDescriptor
import org.jetbrains.kotlin.backend.jvm.serialization.JvmManglerDesc
import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.fir.backend.Fir2IrConverter
@@ -92,8 +94,10 @@ abstract class AbstractFir2IrTextTest : AbstractIrTextTestCase() {
}
}
val signaturer = IdSignatureDescriptor(JvmManglerDesc())
return Fir2IrConverter.createModuleFragment(
session, firFiles, myEnvironment.configuration.languageVersionSettings
session, firFiles, myEnvironment.configuration.languageVersionSettings, signaturer = signaturer
).irModuleFragment
}
}