[kotlinp] Fix: Forgotten sorting of KmClasses in KlibKotlinp

The declarations that are printed by the kotlinp tool may be optionally
sorted. That's controlled by `sortDeclarations` flag in
`org.jetbrains.kotlin.kotlinp.Settings`. However, there was no sorting
implemented for `KmClass`es.

This commit fixes that.

^KT-62340
This commit is contained in:
Dmitriy Dolovov
2024-02-22 17:58:55 +01:00
committed by Space Team
parent edf8dc0421
commit d70dd7808b
@@ -38,7 +38,7 @@ class KlibKotlinp(
appendCommentedLine("class name: ", it)
}
}
moduleFragment.classes.forEach { appendLine(); renderClass(it, printer) }
moduleFragment.classes.sortIfNeeded { it.sortedBy(KmClass::name) }.forEach { appendLine(); renderClass(it, printer) }
moduleFragment.pkg?.let { appendLine(); renderPackage(it, printer) }
}
appendLine("}")