[IR] Rename fqName to packageFqName for IrPackageFragment

This commit is contained in:
Ivan Kylchik
2023-05-15 18:07:50 +02:00
committed by Space Team
parent 75ab2ce4e7
commit b9856320cf
54 changed files with 81 additions and 82 deletions
@@ -86,9 +86,9 @@ internal class DependenciesTrackerImpl(
?: error("Can't find stdlib")
val stdlibDeserializer = context.irLinker.moduleDeserializers[context.stdlibModule]
?: error("No deserializer for stdlib")
val file = stdlibDeserializer.files.atMostOne { it.fqName == fqName && it.name == fileName }
val file = stdlibDeserializer.files.atMostOne { it.packageFqName == fqName && it.name == fileName }
?: error("Can't find $fqName:$fileName in stdlib")
return LibraryFile(stdlib, file.fqName.asString(), file.path)
return LibraryFile(stdlib, file.packageFqName.asString(), file.path)
}
private val stdlibRuntime by lazy { findStdlibFile(KonanFqNames.internalPackageName, "Runtime.kt") }
@@ -124,7 +124,7 @@ internal class DependenciesTrackerImpl(
library == null -> FileOrigin.CurrentFile
packageFragment.packageFragmentDescriptor.containingDeclaration.isFromInteropLibrary() ->
FileOrigin.EntireModule(library)
else -> FileOrigin.CertainFile(library, packageFragment.fqName.asString(), filePathGetter())
else -> FileOrigin.CertainFile(library, packageFragment.packageFqName.asString(), filePathGetter())
}
}
}
@@ -188,7 +188,7 @@ internal class DependenciesTrackerImpl(
require(library.isInteropLibrary()) { "No module deserializer for cached library ${library.uniqueName}" }
} else {
moduleDeserializer.eagerInitializedFiles.forEach {
add(CacheSupport.cacheFileId(it.fqName.asString(), it.path))
add(CacheSupport.cacheFileId(it.packageFqName.asString(), it.path))
}
}
}
@@ -104,7 +104,7 @@ internal fun PhaseContext.fir2Ir(
components.symbolTable.forEachDeclarationSymbol {
val p = it.owner as? IrDeclaration ?: return@forEachDeclarationSymbol
val fragment = (p.getPackageFragment() as? IrExternalPackageFragment) ?: return@forEachDeclarationSymbol
add(fragment.fqName)
add(fragment.packageFqName)
}
// This packages exists in all platform libraries, but can contain only synthetic declarations.
// These declarations are not really located in klib, so we don't need to depend on klib to use them.
@@ -191,7 +191,7 @@ private fun PhaseEngine<out Context>.splitIntoFragments(
val containsStdlib = config.libraryToCache!!.klib == context.stdlibModule.konanLibrary
files.asSequence().filter { !it.isFunctionInterfaceFile }.map { file ->
val cacheDeserializationStrategy = CacheDeserializationStrategy.SingleFile(file.path, file.fqName.asString())
val cacheDeserializationStrategy = CacheDeserializationStrategy.SingleFile(file.path, file.packageFqName.asString())
val llvmModuleSpecification = CacheLlvmModuleSpecification(
config.cachedLibraries,
PartialCacheInfo(config.libraryToCache!!.klib, cacheDeserializationStrategy),
@@ -29,7 +29,7 @@ internal class CodeGenerator(override val generationState: NativeGenerationState
fun llvmFunction(function: IrFunction): LlvmCallable =
llvmFunctionOrNull(function)
?: error("no function ${function.name} in ${function.file.fqName}")
?: error("no function ${function.name} in ${function.file.packageFqName}")
fun llvmFunctionOrNull(function: IrFunction): LlvmCallable? =
function.llvmFunctionOrNull
@@ -764,7 +764,7 @@ internal class CodeGeneratorVisitor(
}
private val IrDeclarationContainer.initVariableSuffix get() = when (this) {
is IrFile -> "${fqName}\$${fileEntry.name}"
is IrFile -> "${packageFqName}\$${fileEntry.name}"
else -> fqNameForIrSerialization.asString()
}
@@ -160,7 +160,7 @@ private class DeclarationsGeneratorVisitor(override val generationState: NativeG
private fun getFqName(declaration: IrDeclaration): FqName {
val parent = declaration.parent
val parentFqName = when (parent) {
is IrPackageFragment -> parent.fqName
is IrPackageFragment -> parent.packageFqName
is IrDeclaration -> getFqName(parent)
else -> error(parent)
}
@@ -595,7 +595,7 @@ internal class RTTIGenerator(
null
}
val packageName: String = reflectionPackageName ?: packageFragment.fqName.asString() // Compute and store package name in TypeInfo anyways.
val packageName: String = reflectionPackageName ?: packageFragment.packageFqName.asString() // Compute and store package name in TypeInfo anyways.
val relativeName: String?
val flags: Int
@@ -731,7 +731,7 @@ private class InteropLoweringPart1(val generationState: NativeGenerationState) :
private fun IrFunction.isAutoreleasepool(): Boolean {
return this.name.asString() == "autoreleasepool" && this.parent.let { parent ->
parent is IrPackageFragment && parent.fqName == InteropFqNames.packageName
parent is IrPackageFragment && parent.packageFqName == InteropFqNames.packageName
}
}
@@ -178,7 +178,7 @@ internal class TestProcessor (val context: Context) {
val topLevelFunctions = mutableListOf<TestFunction>()
val topLevelSuiteClassId: ClassId by lazy {
ClassId(irFile.fqName, PackagePartClassUtils.getFilePartShortName(irFile.fileName).let(Name::identifier))
ClassId(irFile.packageFqName, PackagePartClassUtils.getFilePartShortName(irFile.fileName).let(Name::identifier))
}
val topLevelSuiteName: String get() = topLevelSuiteClassId.asFqNameString()
@@ -546,7 +546,7 @@ internal class TestProcessor (val context: Context) {
/** Check if this fqName already used or not. */
private fun checkTopLevelSuiteName(irFile: IrFile, topLevelSuiteName: String): Boolean {
if (topLevelSuiteNames.contains(topLevelSuiteName)) {
context.reportCompilationError("Package '${irFile.fqName}' has top-level test " +
context.reportCompilationError("Package '${irFile.packageFqName}' has top-level test " +
"functions in several files with the same name: '${irFile.fileName}'")
}
topLevelSuiteNames.add(topLevelSuiteName)
@@ -132,7 +132,7 @@ internal class ByteArrayStream(val buf: ByteArray) {
}
data class SerializedFileReference(val fqName: String, val path: String) {
constructor(irFile: IrFile) : this(irFile.fqName.asString(), irFile.path)
constructor(irFile: IrFile) : this(irFile.packageFqName.asString(), irFile.path)
}
private class StringTableBuilder {
@@ -597,7 +597,7 @@ internal class KonanIrLinker(
}
private val fileReferenceToFileDeserializationState by lazy {
fileDeserializationStates.associateBy { SerializedFileReference(it.file.fqName.asString(), it.file.path) }
fileDeserializationStates.associateBy { SerializedFileReference(it.file.packageFqName.asString(), it.file.path) }
}
private val SerializedFileReference.deserializationState
@@ -1011,7 +1011,7 @@ internal class KonanIrLinker(
val sortedFileIds by lazy {
fileDeserializationStates
.sortedBy { it.file.fileEntry.name }
.map { CacheSupport.cacheFileId(it.file.fqName.asString(), it.file.fileEntry.name) }
.map { CacheSupport.cacheFileId(it.file.packageFqName.asString(), it.file.fileEntry.name) }
}
}