mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-18 00:21:29 +00:00
[IR SERIALIZATION] Fix rebase
This commit is contained in:
@@ -38,7 +38,7 @@ abstract class GlobalDeclarationTable(private val mangler: KotlinMangler, privat
|
||||
protected open fun loadKnownBuiltins(builtIns: IrBuiltIns, startIndex: Long): Long {
|
||||
var index = startIndex
|
||||
builtIns.knownBuiltins.forEach {
|
||||
table[it.owner] = UniqId(index++, false)
|
||||
table[it.owner] = UniqId(index++, false).also { id -> clashTracker.commit(it.owner, id) }
|
||||
}
|
||||
return index
|
||||
}
|
||||
|
||||
@@ -29,11 +29,7 @@ abstract class DescriptorReferenceDeserializer(
|
||||
) : DescriptorUniqIdAware {
|
||||
|
||||
protected open fun resolveSpecialDescriptor(fqn: FqName) = builtIns.builtIns.getBuiltInClassByFqName(fqn)
|
||||
|
||||
protected abstract fun resolveSpecialDescriptor(fqn: FqName): DeclarationDescriptor
|
||||
abstract fun checkIfSpecialDescriptorId(id: Long): Boolean
|
||||
protected abstract fun getDescriptorIdOrNull(descriptor: DeclarationDescriptor): Long?
|
||||
protected open fun checkIfSpecialDescriptorId(id: Long) = with(mangler) { id.isSpecial }
|
||||
open fun checkIfSpecialDescriptorId(id: Long) = with(mangler) { id.isSpecial }
|
||||
|
||||
protected open fun getDescriptorIdOrNull(descriptor: DeclarationDescriptor) =
|
||||
if (isBuiltInFunction(descriptor)) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.backend.common.serialization
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.LoggingContext
|
||||
import org.jetbrains.kotlin.builtins.FunctionInterfacePackageFragment
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.library.SerializedIrFile
|
||||
@@ -20,6 +21,6 @@ abstract class IrModuleSerializer<F : IrFileSerializer>(protected val logger: Lo
|
||||
}
|
||||
|
||||
fun serializedIrModule(module: IrModuleFragment): SerializedIrModule {
|
||||
return SerializedIrModule(module.files.map { serializeIrFile(it) })
|
||||
return SerializedIrModule(module.files.filter { it.packageFragmentDescriptor !is FunctionInterfacePackageFragment }.map { serializeIrFile(it) })
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.serialization.DeclarationTable
|
||||
import org.jetbrains.kotlin.backend.common.serialization.DescriptorTable
|
||||
import org.jetbrains.kotlin.backend.common.serialization.*
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.util.render
|
||||
|
||||
@@ -27,11 +27,7 @@ class JsUniqIdClashTracker: UniqIdClashTracker {
|
||||
}
|
||||
|
||||
class JsGlobalDeclarationTable(builtIns: IrBuiltIns) : GlobalDeclarationTable(JsMangler, JsUniqIdClashTracker()) {
|
||||
private val FUNCTION_INDEX_START: Long = loadKnownBuiltins(builtIns, PUBLIC_LOCAL_UNIQ_ID_EDGE)
|
||||
|
||||
override fun computeUniqIdByDeclaration(declaration: IrDeclaration): UniqId {
|
||||
return if (isBuiltInFunction(declaration)) {
|
||||
UniqId(FUNCTION_INDEX_START + builtInFunctionId(declaration), false)
|
||||
} else super.computeUniqIdByDeclaration(declaration)
|
||||
init {
|
||||
loadKnownBuiltins(builtIns, PUBLIC_LOCAL_UNIQ_ID_EDGE)
|
||||
}
|
||||
}
|
||||
@@ -23,9 +23,6 @@ class JsIrLinker(
|
||||
) : KotlinIrLinker(logger, builtIns, symbolTable, emptyList(), null, PUBLIC_LOCAL_UNIQ_ID_EDGE),
|
||||
DescriptorUniqIdAware by JsDescriptorUniqIdAware {
|
||||
|
||||
override fun getPrimitiveTypeOrNull(symbol: IrClassifierSymbol, hasQuestionMark: Boolean) =
|
||||
builtIns.getPrimitiveTypeOrNullByDescriptor(symbol.descriptor, hasQuestionMark)
|
||||
|
||||
override val descriptorReferenceDeserializer =
|
||||
JsDescriptorReferenceDeserializer(currentModule, mangler, builtIns)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user