SLC: use partition to distinguish ctor properties from regular members

This commit is contained in:
Jinseong Jeon
2022-08-28 16:37:51 -07:00
committed by Ilya Kirillov
parent 4859524115
commit d4efc8d81d
@@ -176,7 +176,7 @@ internal fun SymbolLightClassBase.createMethods(
isTopLevel: Boolean = false,
suppressStatic: Boolean = false
) {
val declarationGroups = declarations.groupBy { it is KtPropertySymbol && it.isFromPrimaryConstructor }
val (ctorProperties, regularMembers) = declarations.partition { it is KtPropertySymbol && it.isFromPrimaryConstructor }
fun handleDeclaration(declaration: KtCallableSymbol) {
when (declaration) {
@@ -229,11 +229,11 @@ internal fun SymbolLightClassBase.createMethods(
}
// Regular members
declarationGroups[false]?.forEach {
regularMembers.forEach {
handleDeclaration(it)
}
// Then, properties from the primary constructor parameters
declarationGroups[true]?.forEach {
ctorProperties.forEach {
handleDeclaration(it)
}
}