Minor build fix: "Convert to apply" is now applicable only with 2+ calls with the same receiver
This commit is contained in:
@@ -40,9 +40,13 @@ class ConvertToApplyIntention : ConvertToScopeIntention<KtExpression>(
|
|||||||
|
|
||||||
private fun KtProperty.isApplicable(): Boolean {
|
private fun KtProperty.isApplicable(): Boolean {
|
||||||
if (!isLocal) return false
|
if (!isLocal) return false
|
||||||
val nextSibling = getDotQualifiedSiblingIfAny(forward = true)
|
|
||||||
val localVariableName = name ?: return false
|
val localVariableName = name ?: return false
|
||||||
return nextSibling != null && isApplicableWithGivenReceiverText(nextSibling, localVariableName)
|
val firstDotQualified = getDotQualifiedSiblingIfAny(forward = true)
|
||||||
|
if (firstDotQualified != null && isApplicableWithGivenReceiverText(firstDotQualified, localVariableName)) {
|
||||||
|
val nextDotQualified = firstDotQualified.getDotQualifiedSiblingIfAny(forward = true)
|
||||||
|
return nextDotQualified != null && isApplicableWithGivenReceiverText(nextDotQualified, localVariableName)
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun KtDotQualifiedExpression.findTargetProperty(receiverExpressionText: String): KtProperty? {
|
private fun KtDotQualifiedExpression.findTargetProperty(receiverExpressionText: String): KtProperty? {
|
||||||
|
|||||||
Reference in New Issue
Block a user