[IR SERIALIZATION] Fix ONLY_DECLARATION_HEADERS mode
This commit is contained in:
+16
-25
@@ -423,30 +423,18 @@ abstract class KotlinIrLinker(
|
|||||||
moduleReversedFileIndex.getOrPut(uniqId) { fileDeserializer }
|
moduleReversedFileIndex.getOrPut(uniqId) { fileDeserializer }
|
||||||
}
|
}
|
||||||
|
|
||||||
when (deserializationStrategy) {
|
val forceLoadedIds = deserializationStrategy.run {
|
||||||
DeserializationStrategy.EXPLICITLY_EXPORTED -> {
|
when {
|
||||||
fileProto.explicitlyExportedToCompilerList.forEach {
|
theWholeWorld -> fileProto.declarationIdList
|
||||||
val symbolProto = fileDeserializer.loadSymbolData(it.index)
|
explicitlyExported -> fileProto.explicitlyExportedToCompilerList.map {
|
||||||
val topLevelUniqId = symbolProto.topLevelUniqId
|
fileDeserializer.loadSymbolData(it.index).topLevelUniqId
|
||||||
val uniqId = topLevelUniqId.uniqId()
|
|
||||||
assert(uniqId.isPublic)
|
|
||||||
// if (topLevelUniqId.isLocal) {
|
|
||||||
// fileDeserializer.fileLocalDeserializationState.addUniqID(uniqId)
|
|
||||||
// } else {
|
|
||||||
moduleDeserializationState.addUniqID(uniqId)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
else -> emptyList()
|
||||||
}
|
}
|
||||||
DeserializationStrategy.ALL -> {
|
|
||||||
fileProto.declarationIdList.forEach {
|
|
||||||
val uniqId = it.uniqId()
|
|
||||||
assert(uniqId.isPublic)
|
|
||||||
moduleDeserializationState.addUniqID(uniqId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else -> error("Unexpected deserialization strategy")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
forceLoadedIds.forEach { moduleDeserializationState.addUniqID(it.uniqId().also { i -> assert(i.isPublic) }) }
|
||||||
|
|
||||||
return file
|
return file
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -626,11 +614,14 @@ abstract class KotlinIrLinker(
|
|||||||
|
|
||||||
fun deserializeFullModule(moduleDescriptor: ModuleDescriptor): IrModuleFragment =
|
fun deserializeFullModule(moduleDescriptor: ModuleDescriptor): IrModuleFragment =
|
||||||
deserializeIrModuleHeader(moduleDescriptor, DeserializationStrategy.ALL)
|
deserializeIrModuleHeader(moduleDescriptor, DeserializationStrategy.ALL)
|
||||||
|
|
||||||
|
fun deserializeOnlyHeaderModule(moduleDescriptor: ModuleDescriptor): IrModuleFragment =
|
||||||
|
deserializeIrModuleHeader(moduleDescriptor, DeserializationStrategy.ONLY_DECLARATION_HEADERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class DeserializationStrategy(val needBodies: Boolean) {
|
enum class DeserializationStrategy(val needBodies: Boolean, val explicitlyExported: Boolean, val theWholeWorld: Boolean) {
|
||||||
ONLY_REFERENCED(true),
|
ONLY_REFERENCED(true, false, false),
|
||||||
ALL(true),
|
ALL(true, true, true),
|
||||||
EXPLICITLY_EXPORTED(true),
|
EXPLICITLY_EXPORTED(true, true, false),
|
||||||
ONLY_DECLARATION_HEADERS(false)
|
ONLY_DECLARATION_HEADERS(false, false, false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ dependencies {
|
|||||||
testCompile(project(":compiler:cli"))
|
testCompile(project(":compiler:cli"))
|
||||||
testCompile(project(":compiler:util"))
|
testCompile(project(":compiler:util"))
|
||||||
|
|
||||||
|
testRuntime(project(":kotlin-reflect"))
|
||||||
testRuntime(intellijDep()) { includeJars("picocontainer", "trove4j", "guava", "jdom", rootProject = rootProject) }
|
testRuntime(intellijDep()) { includeJars("picocontainer", "trove4j", "guava", "jdom", rootProject = rootProject) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user