org.jetbrains.kotlin.ir.declarations.IrExternalPackageFragment.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-compiler-embeddable Show documentation
Show all versions of kotlin-compiler-embeddable Show documentation
the Kotlin compiler embeddable
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
// This file was generated automatically. See compiler/ir/ir.tree/tree-generator/ReadMe.md.
// DO NOT MODIFY IT MANUALLY.
package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.ir.symbols.IrExternalPackageFragmentSymbol
import org.jetbrains.kotlin.ir.util.transformInPlace
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
/**
* 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]
*/
abstract class IrExternalPackageFragment : IrPackageFragment() {
abstract override val symbol: IrExternalPackageFragmentSymbol
override fun accept(visitor: IrElementVisitor, data: D): R =
visitor.visitExternalPackageFragment(this, data)
override fun acceptChildren(visitor: IrElementVisitor, data: D) {
declarations.forEach { it.accept(visitor, data) }
}
override fun transformChildren(transformer: IrElementTransformer, data: D) {
declarations.transformInPlace(transformer, data)
}
}