Extract some common code into extractRelatedDeclaration

This commit is contained in:
Ivan Kylchik
2023-02-13 16:29:28 +01:00
committed by Space Team
parent 4fc95624a0
commit 4ab38ffcfc
3 changed files with 12 additions and 21 deletions
@@ -1402,3 +1402,12 @@ val Int.previousOffset
-1 -> UNDEFINED_OFFSET
else -> minus(1)
}
fun IrAttributeContainer.extractRelatedDeclaration(): IrDeclaration? {
return when (this) {
is IrClass -> this
is IrFunctionExpression -> function
is IrFunctionReference -> symbol.owner
else -> null
}
}