Fix IrFunction.isEmptyArray implementation

The previous one was incorrect for K1 since parent of top-level function
is `IrClass`, not `IrPackageFragment`.

The change is non-functional, K1 still worked correctly, but had to do
some extra work when inlining `emptyArray` calls and produces less
performant bytecode.
This commit is contained in:
vladislav.grechko
2024-02-21 14:04:07 +01:00
committed by Space Team
parent 224a4e1e3c
commit f32367d2c2
26 changed files with 70 additions and 219 deletions
@@ -113,6 +113,4 @@ internal fun IrFunction.isArrayOf(): Boolean {
valueParameters[0].isVararg
}
internal fun IrFunction.isEmptyArray(): Boolean =
name.asString() == "emptyArray" &&
(parent as? IrPackageFragment)?.packageFqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME
internal fun IrFunction.isEmptyArray(): Boolean = isTopLevelInPackage("emptyArray", StandardNames.BUILT_INS_PACKAGE_FQ_NAME)