[IR] Add kdoc for IrExternalPackageFragment

This commit is contained in:
Pavel Kunyavskiy
2024-02-12 10:50:16 +01:00
committed by Space Team
parent b24c75d04c
commit 7e3e9aafa4
2 changed files with 33 additions and 1 deletions
@@ -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]
*/
@@ -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)