[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
@@ -32,7 +32,7 @@ class ExportModelGenerator(val context: JsIrBackendContext, val generateNamespac
private val transitiveExportCollector = TransitiveExportCollector(context)
fun generateExport(file: IrPackageFragment): List<ExportedDeclaration> {
val namespaceFqName = file.fqName
val namespaceFqName = file.packageFqName
val exports = file.declarations.memoryOptimizedFlatMap { declaration -> listOfNotNull(exportDeclaration(declaration)) }
return when {
exports.isEmpty() -> emptyList()
@@ -51,7 +51,7 @@ private val JsPackage = FqName("kotlin.js")
private val JsIntrinsicFqName = FqName("kotlin.js.JsIntrinsic")
private fun IrDeclaration.isPlacedInsideInternalPackage() =
(parent as? IrPackageFragment)?.fqName == JsPackage
(parent as? IrPackageFragment)?.packageFqName == JsPackage
private fun isIntrinsic(declaration: IrDeclaration): Boolean =
declaration is IrSimpleFunction && declaration.isPlacedInsideInternalPackage() &&
@@ -73,7 +73,7 @@ class MoveBodilessDeclarationsToSeparatePlaceLowering(private val context: JsIrB
val externalPackageFragment by lazy(LazyThreadSafetyMode.NONE) {
context.externalPackageFragment.getOrPut(irFile.symbol) {
IrFileImpl(fileEntry = irFile.fileEntry, fqName = irFile.fqName, symbol = IrFileSymbolImpl(), module = irFile.module).also {
IrFileImpl(fileEntry = irFile.fileEntry, fqName = irFile.packageFqName, symbol = IrFileSymbolImpl(), module = irFile.module).also {
it.annotations = it.annotations memoryOptimizedPlus irFile.annotations
}
}
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.ir.util.transformFlat
fun moveOpenClassesToSeparateFiles(moduleFragment: IrModuleFragment) {
fun createFile(file: IrFile, klass: IrClass): IrFile =
IrFileImpl(fileEntry = file.fileEntry, fqName = file.fqName, symbol = IrFileSymbolImpl(), module = file.module).also {
IrFileImpl(fileEntry = file.fileEntry, fqName = file.packageFqName, symbol = IrFileSymbolImpl(), module = file.module).also {
it.annotations = it.annotations memoryOptimizedPlus file.annotations
it.declarations += klass
klass.parent = it
@@ -55,8 +55,8 @@ class TestGenerator(val context: JsCommonBackendContext, val groupByPackage: Boo
private val packageSuites = hashMapOf<FqName, IrSimpleFunction>()
private fun suiteForPackage(irFile: IrFile) = packageSuites.getOrPut(irFile.fqName) {
context.suiteFun!!.createInvocation(irFile.fqName.asString(), context.createTestContainerFun(irFile))
private fun suiteForPackage(irFile: IrFile) = packageSuites.getOrPut(irFile.packageFqName) {
context.suiteFun!!.createInvocation(irFile.packageFqName.asString(), context.createTestContainerFun(irFile))
}
private fun IrSimpleFunctionSymbol.createInvocation(
@@ -233,7 +233,7 @@ class IrModuleToJsTransformer(
globalNameScope = globalNameScope
)
val result = JsIrProgramFragment(fileExports.file.fqName.asString()).apply {
val result = JsIrProgramFragment(fileExports.file.packageFqName.asString()).apply {
if (shouldGeneratePolyfills) {
polyfills.statements += backendContext.polyfills.getAllPolyfillsFor(fileExports.file)
}
@@ -73,7 +73,7 @@ fun IrConstructor.hasStrictSignature(context: JsIrBackendContext): Boolean {
}
private fun getKotlinOrJsQualifier(parent: IrPackageFragment, shouldIncludePackage: Boolean): FqName? {
return (parent as? IrFile)?.getJsQualifier()?.let { FqName(it) } ?: parent.fqName.takeIf { shouldIncludePackage }
return (parent as? IrFile)?.getJsQualifier()?.let { FqName(it) } ?: parent.packageFqName.takeIf { shouldIncludePackage }
}
val IrFunctionAccessExpression.typeArguments: List<IrType?>
@@ -56,7 +56,7 @@ class JsMainFunctionDetector(val context: JsCommonBackendContext) {
var resultPair: Pair<String, IrSimpleFunction>? = null
module.files.forEach { f ->
val fqn = f.fqName.asString()
val fqn = f.packageFqName.asString()
getMainFunctionOrNull(f)?.let {
val result = resultPair
if (result == null) {