IR: extract & rename getTopLevelDeclaration() to IrLazyFunctionBase

This commit is contained in:
Mikhail Glukhikh
2023-02-17 11:39:28 +01:00
committed by Space Team
parent 7420008af9
commit f075c9d50b
3 changed files with 11 additions and 21 deletions
@@ -123,18 +123,10 @@ abstract class AbstractFir2IrLazyFunction<F : FirCallableDeclaration>(
private fun tryLoadIr(): Boolean {
if (!isInline || isFakeOverride) return false
if (!extensions.irNeedsDeserialization) return false
val toplevel = getToplevel()
val toplevel = getTopLevelDeclaration()
return (toplevel as? DeserializableClass)?.loadIr() ?: false
}
private fun getToplevel(): IrDeclaration {
var current: IrDeclaration = this
while (current.parent !is IrPackageFragment) {
current = current.parent as IrDeclaration
}
return current
}
companion object {
private val JVM_STATIC_CLASS_ID = ClassId.topLevel(JVM_STATIC_ANNOTATION_FQ_NAME)
}