FIR: introduce & use various comparators to sort members while de/serialization
#KT-41018 fixed
This commit is contained in:
committed by
Mikhail Zarechenskiy
parent
91c021c699
commit
e8157a5488
+11
@@ -172,6 +172,17 @@ fun deserializeClassToSymbol(
|
||||
|
||||
addCloneForArrayIfNeeded(classId)
|
||||
addSerializableIfNeeded(classId)
|
||||
|
||||
declarations.sortWith(object : Comparator<FirDeclaration> {
|
||||
override fun compare(a: FirDeclaration, b: FirDeclaration): Int {
|
||||
// Reorder members based on their type and name only.
|
||||
// See FE 1.0's [DeserializedMemberScope#addMembers].
|
||||
if (a is FirMemberDeclaration && b is FirMemberDeclaration) {
|
||||
return FirMemberDeclarationComparator.TypeAndNameComparator.compare(a, b)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
})
|
||||
}.also {
|
||||
if (isSealed) {
|
||||
it.sealedInheritors = classProto.sealedSubclassFqNameList.map { nameIndex ->
|
||||
|
||||
Reference in New Issue
Block a user