[IR] Move IrElement#sourceElement to the ir.tree module

This is so that it could be used from more places.
Namely, we need to use it from the `serialization.common` module.
This commit is contained in:
Sergej Jaskiewicz
2023-12-15 16:30:54 +01:00
committed by Space Team
parent 9c3de4332f
commit 3430551681
5 changed files with 11 additions and 15 deletions
@@ -5,6 +5,8 @@
package org.jetbrains.kotlin.ir.util
import org.jetbrains.kotlin.AbstractKtSourceElement
import org.jetbrains.kotlin.KtOffsetsOnlySourceElement
import org.jetbrains.kotlin.builtins.PrimitiveType
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.builtins.UnsignedType
@@ -1610,4 +1612,8 @@ val IrDeclaration.parents: Sequence<IrDeclarationParent>
val IrDeclaration.isExpect
get() = this is IrClass && isExpect ||
this is IrFunction && isExpect ||
this is IrProperty && isExpect
this is IrProperty && isExpect
fun IrElement.sourceElement(): AbstractKtSourceElement? =
if (startOffset >= 0) KtOffsetsOnlySourceElement(this.startOffset, this.endOffset)
else null