Reformat JoinDeclarationAndAssignmentIntention
This commit is contained in:
committed by
Mikhail Glukhikh
parent
d45e83b27d
commit
8078c5da40
+4
-4
@@ -59,7 +59,8 @@ class JoinDeclarationAndAssignmentIntention : SelfTargetingRangeIntention<KtProp
|
|||||||
|| element.setter != null
|
|| element.setter != null
|
||||||
|| element.getter != null
|
|| element.getter != null
|
||||||
|| element.receiverTypeReference != null
|
|| element.receiverTypeReference != null
|
||||||
|| element.name == null) {
|
|| element.name == null
|
||||||
|
) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,8 +110,7 @@ class JoinDeclarationAndAssignmentIntention : SelfTargetingRangeIntention<KtProp
|
|||||||
val assignments = mutableListOf<KtBinaryExpression>()
|
val assignments = mutableListOf<KtBinaryExpression>()
|
||||||
fun process(binaryExpr: KtBinaryExpression) {
|
fun process(binaryExpr: KtBinaryExpression) {
|
||||||
if (binaryExpr.operationToken != KtTokens.EQ) return
|
if (binaryExpr.operationToken != KtTokens.EQ) return
|
||||||
val left = binaryExpr.left
|
val leftReference = when (val left = binaryExpr.left) {
|
||||||
val leftReference = when (left) {
|
|
||||||
is KtNameReferenceExpression ->
|
is KtNameReferenceExpression ->
|
||||||
left
|
left
|
||||||
is KtDotQualifiedExpression ->
|
is KtDotQualifiedExpression ->
|
||||||
@@ -138,7 +138,7 @@ class JoinDeclarationAndAssignmentIntention : SelfTargetingRangeIntention<KtProp
|
|||||||
if (assignments.any { it.parent.invalidParent() }) return null
|
if (assignments.any { it.parent.invalidParent() }) return null
|
||||||
|
|
||||||
val firstAssignment = assignments.firstOrNull() ?: return null
|
val firstAssignment = assignments.firstOrNull() ?: return null
|
||||||
if (assignments.any { it !== firstAssignment && it.parent.parent is KtSecondaryConstructor}) return null
|
if (assignments.any { it !== firstAssignment && it.parent.parent is KtSecondaryConstructor }) return null
|
||||||
|
|
||||||
val context = firstAssignment.analyze()
|
val context = firstAssignment.analyze()
|
||||||
val propertyDescriptor = context[BindingContext.DECLARATION_TO_DESCRIPTOR, property] ?: return null
|
val propertyDescriptor = context[BindingContext.DECLARATION_TO_DESCRIPTOR, property] ?: return null
|
||||||
|
|||||||
Reference in New Issue
Block a user