SLC: use partition to distinguish ctor properties from regular members
This commit is contained in:
committed by
Ilya Kirillov
parent
4859524115
commit
d4efc8d81d
+3
-3
@@ -176,7 +176,7 @@ internal fun SymbolLightClassBase.createMethods(
|
|||||||
isTopLevel: Boolean = false,
|
isTopLevel: Boolean = false,
|
||||||
suppressStatic: 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) {
|
fun handleDeclaration(declaration: KtCallableSymbol) {
|
||||||
when (declaration) {
|
when (declaration) {
|
||||||
@@ -229,11 +229,11 @@ internal fun SymbolLightClassBase.createMethods(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Regular members
|
// Regular members
|
||||||
declarationGroups[false]?.forEach {
|
regularMembers.forEach {
|
||||||
handleDeclaration(it)
|
handleDeclaration(it)
|
||||||
}
|
}
|
||||||
// Then, properties from the primary constructor parameters
|
// Then, properties from the primary constructor parameters
|
||||||
declarationGroups[true]?.forEach {
|
ctorProperties.forEach {
|
||||||
handleDeclaration(it)
|
handleDeclaration(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user