[JS IR] IC: avoid conflicts in local declaration signatures
This commit is contained in:
+1
@@ -73,6 +73,7 @@ class FileDeserializationState(
|
||||
fileProto.actualList,
|
||||
::addIdSignature,
|
||||
linker::handleExpectActualMapping,
|
||||
symbolProcessor = linker.symbolProcessor,
|
||||
) { idSig, symbolKind ->
|
||||
|
||||
val topLevelSig = idSig.topLevelSignature()
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ class IrSymbolDeserializer(
|
||||
val handleExpectActualMapping: (IdSignature, IrSymbol) -> IrSymbol,
|
||||
private val enqueueAllDeclarations: Boolean = false,
|
||||
val deserializedSymbols: MutableMap<IdSignature, IrSymbol> = mutableMapOf(), // Per-file signature cache. TODO: do we really need it?
|
||||
val symbolProcessor: IrSymbolDeserializer.(IrSymbol, IdSignature) -> IrSymbol = { s, _ -> s },
|
||||
val deserializePublicSymbol: (IdSignature, BinarySymbolData.SymbolKind) -> IrSymbol,
|
||||
) {
|
||||
|
||||
@@ -39,7 +40,7 @@ class IrSymbolDeserializer(
|
||||
}
|
||||
|
||||
private fun referenceDeserializedSymbol(symbolKind: BinarySymbolData.SymbolKind, idSig: IdSignature): IrSymbol {
|
||||
return referenceDeserializedSymbol(symbolTable, fileSymbol, symbolKind, idSig)
|
||||
return symbolProcessor(referenceDeserializedSymbol(symbolTable, fileSymbol, symbolKind, idSig), idSig)
|
||||
}
|
||||
|
||||
fun referenceLocalIrSymbol(symbol: IrSymbol, signature: IdSignature) {
|
||||
|
||||
+2
-1
@@ -36,7 +36,8 @@ abstract class KotlinIrLinker(
|
||||
val builtIns: IrBuiltIns,
|
||||
val symbolTable: SymbolTable,
|
||||
private val exportedDependencies: List<ModuleDescriptor>,
|
||||
private val allowUnboundSymbols: Boolean = false
|
||||
private val allowUnboundSymbols: Boolean = false,
|
||||
val symbolProcessor: IrSymbolDeserializer.(IrSymbol, IdSignature) -> IrSymbol = { s, _ -> s },
|
||||
) : IrDeserializer, FileLocalAwareLinker {
|
||||
|
||||
// Kotlin-MPP related data. Consider some refactoring
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ class IcFileDeserializer(
|
||||
{ _, s -> s },
|
||||
enqueueAllDeclarations = true,
|
||||
deserializedSymbols = deserializedSymbols,
|
||||
::deserializePublicSymbol
|
||||
deserializePublicSymbol = ::deserializePublicSymbol
|
||||
)
|
||||
|
||||
private val declarationDeserializer = IrDeclarationDeserializer(
|
||||
|
||||
+14
-5
@@ -16,10 +16,7 @@ import org.jetbrains.kotlin.ir.builders.TranslationPluginContext
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrFactory
|
||||
import org.jetbrains.kotlin.ir.types.IrTypeSystemContextImpl
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
import org.jetbrains.kotlin.ir.util.ReferenceSymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.TypeTranslator
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.library.IrLibrary
|
||||
import org.jetbrains.kotlin.library.KotlinAbiVersion
|
||||
import org.jetbrains.kotlin.library.KotlinLibrary
|
||||
@@ -32,7 +29,19 @@ class JsIrLinker(
|
||||
private val loweredIcData: Map<ModuleDescriptor, SerializedIcData> = emptyMap(),
|
||||
friendModules: Map<String, Collection<String>> = emptyMap(),
|
||||
allowUnboundSymbols: Boolean = false
|
||||
) : KotlinIrLinker(currentModule, messageLogger, builtIns, symbolTable, emptyList(), allowUnboundSymbols) {
|
||||
) : KotlinIrLinker(
|
||||
currentModule,
|
||||
messageLogger,
|
||||
builtIns,
|
||||
symbolTable,
|
||||
emptyList(),
|
||||
allowUnboundSymbols,
|
||||
symbolProcessor = { symbol, idSig ->
|
||||
if (idSig.isLocal) {
|
||||
symbol.privateSignature = IdSignature.CompositeSignature(IdSignature.FileSignature(fileSymbol), idSig)
|
||||
}
|
||||
symbol
|
||||
}) {
|
||||
|
||||
override val fakeOverrideBuilder = FakeOverrideBuilder(this, symbolTable, JsManglerIr, IrTypeSystemContextImpl(builtIns), friendModules)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user