From 7e3e9aafa499cbbcabb1d8af6fd8392d98c3ace7 Mon Sep 17 00:00:00 2001 From: Pavel Kunyavskiy Date: Mon, 12 Feb 2024 10:50:16 +0100 Subject: [PATCH] [IR] Add kdoc for IrExternalPackageFragment --- .../declarations/IrExternalPackageFragment.kt | 16 +++++++++++++++- .../jetbrains/kotlin/ir/generator/IrTree.kt | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrExternalPackageFragment.kt b/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrExternalPackageFragment.kt index c415d402171..4d1397a2a57 100644 --- a/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrExternalPackageFragment.kt +++ b/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrExternalPackageFragment.kt @@ -15,7 +15,21 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource /** - * A leaf IR tree element. + * This is a root parent element for external declarations (meaning those that come from + * another compilation unit/module, not to be confused with [IrPossiblyExternalDeclaration.isExternal]). + * + * Each declaration is contained either in some [IrFile], or in some [IrExternalPackageFragment]. + * Declarations coming from dependencies are located in [IrExternalPackageFragment]. + * + * It can be used for obtaining a module descriptor, which contains the information about + * the module from which the declaration came. It would be more correct to have a link to some + * [IrModuleFragment] instead, which would make [IrModuleFragment] the only source of truth about modules, + * but this is how things are now. + * + * Also, it can be used for checking whether some declaration is external (by checking whether its top + * level parent is an [IrExternalPackageFragment]). But it is not possible + * to get all declarations from a fragment. Also, being in the same or different + * fragment doesn't mean anything. There can be more than one fragment for the same dependency. * * Generated from: [org.jetbrains.kotlin.ir.generator.IrTree.externalPackageFragment] */ diff --git a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/IrTree.kt b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/IrTree.kt index 416daca6bf4..75521c49aef 100644 --- a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/IrTree.kt +++ b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/IrTree.kt @@ -625,6 +625,24 @@ object IrTree : AbstractTreeBuilder() { transformByChildren = true generateIrFactoryMethod = false + kDoc = """ + This is a root parent element for external declarations (meaning those that come from + another compilation unit/module, not to be confused with [IrPossiblyExternalDeclaration.isExternal]). + + Each declaration is contained either in some [IrFile], or in some [IrExternalPackageFragment]. + Declarations coming from dependencies are located in [IrExternalPackageFragment]. + + It can be used for obtaining a module descriptor, which contains the information about + the module from which the declaration came. It would be more correct to have a link to some + [IrModuleFragment] instead, which would make [IrModuleFragment] the only source of truth about modules, + but this is how things are now. + + Also, it can be used for checking whether some declaration is external (by checking whether its top + level parent is an [IrExternalPackageFragment]). But it is not possible + to get all declarations from a fragment. Also, being in the same or different + fragment doesn't mean anything. There can be more than one fragment for the same dependency. + """.trimIndent() + parent(packageFragment) +symbol(externalPackageFragmentSymbolType)