JVM IR: use a simpler way to check if class is local
This commit is contained in:
@@ -272,17 +272,6 @@ val IrDeclaration.parentAsClass: IrClass
|
||||
get() = parent as? IrClass
|
||||
?: error("Parent of this declaration is not a class: ${render()}")
|
||||
|
||||
fun IrClass.isLocalClass(): Boolean {
|
||||
var current: IrDeclarationParent? = this
|
||||
while (current != null && current !is IrPackageFragment) {
|
||||
if (current is IrDeclarationWithVisibility && current.visibility == Visibilities.LOCAL)
|
||||
return true
|
||||
current = (current as? IrDeclaration)?.parent
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
tailrec fun IrElement.getPackageFragment(): IrPackageFragment? {
|
||||
if (this is IrPackageFragment) return this
|
||||
return when (val parent = (this as? IrDeclaration)?.parent) {
|
||||
|
||||
Reference in New Issue
Block a user