From b939530a5cc47d64e19500ac400a23fc1dcaf100 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Wed, 25 Mar 2015 13:04:38 +0300 Subject: [PATCH] Minor, Rename isEmpty -> isImplicit --- .../kotlin/diagnostics/PositioningStrategies.kt | 2 +- .../kotlin/psi/JetConstructorDelegationCall.java | 2 +- .../jetbrains/kotlin/psi/JetSecondaryConstructor.java | 11 +++++------ .../jetbrains/kotlin/resolve/calls/CallResolver.java | 6 +++--- ...ngStrategyForImplicitConstructorDelegationCall.kt} | 2 +- .../idea/quickfix/InsertDelegationCallQuickfix.kt | 8 ++++---- .../usages/JetConstructorDelegationCallUsage.kt | 6 +++--- 7 files changed, 18 insertions(+), 19 deletions(-) rename compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/{TracingStrategyForEmptyConstructorDelegationCall.kt => TracingStrategyForImplicitConstructorDelegationCall.kt} (98%) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index 4122700374e..86288d0704f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -418,7 +418,7 @@ public object PositioningStrategies { public val SECONDARY_CONSTRUCTOR_DELEGATION_CALL: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: JetConstructorDelegationCall): List { - if (element.isEmpty()) { + if (element.isImplicit()) { val constructor = element.getStrictParentOfType()!! val valueParameterList = constructor.getValueParameterList() ?: return markElement(constructor) return markRange(constructor.getConstructorKeyword(), valueParameterList.getLastChild()) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetConstructorDelegationCall.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetConstructorDelegationCall.java index 8d467d01918..68dbb36cb16 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetConstructorDelegationCall.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetConstructorDelegationCall.java @@ -65,7 +65,7 @@ public class JetConstructorDelegationCall extends JetElementImpl implements JetC return findChildByClass(JetConstructorDelegationReferenceExpression.class); } - public boolean isEmpty() { + public boolean isImplicit() { JetConstructorDelegationReferenceExpression callee = getCalleeExpression(); return callee != null && callee.getFirstChild() == null; } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSecondaryConstructor.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSecondaryConstructor.java index a406e3f253d..91f57daeeaa 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSecondaryConstructor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSecondaryConstructor.java @@ -177,9 +177,8 @@ public class JetSecondaryConstructor extends JetDeclarationStub() ?: return null if (secondaryConstructor.getClassOrObject().getConstructorsCount() <= 1 || - !secondaryConstructor.hasEmptyDelegationCall()) return null + !secondaryConstructor.hasImplicitDelegationCall()) return null return InsertDelegationCallQuickfix(isThis = true, element = secondaryConstructor) } @@ -73,7 +73,7 @@ public class InsertDelegationCallQuickfix(val isThis: Boolean, element: JetSecon object InsertSuperDelegationCallFactory : JetSingleIntentionActionFactory() { override fun createAction(diagnostic: Diagnostic): IntentionAction? { val secondaryConstructor = diagnostic.getPsiElement().getNonStrictParentOfType() ?: return null - if (!secondaryConstructor.hasEmptyDelegationCall()) return null + if (!secondaryConstructor.hasImplicitDelegationCall()) return null val klass = secondaryConstructor.getClassOrObject() as? JetClass ?: return null if (klass.hasPrimaryConstructor()) return null diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/usages/JetConstructorDelegationCallUsage.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/usages/JetConstructorDelegationCallUsage.kt index ddb873d5a81..f24fa956ef3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/usages/JetConstructorDelegationCallUsage.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/usages/JetConstructorDelegationCallUsage.kt @@ -29,15 +29,15 @@ public class JetConstructorDelegationCallUsage(call: JetConstructorDelegationCal val isThisCall = element.isCallToThis() var elementToWorkWith = element - if (changeInfo.getNewParametersCount() > 0 && element.isEmpty()) { + if (changeInfo.getNewParametersCount() > 0 && element.isImplicit()) { val constructor = element.getParent() as JetSecondaryConstructor - elementToWorkWith = constructor.replaceEmptyDelegationCallWithExplicit(isThisCall) + elementToWorkWith = constructor.replaceImplicitDelegationCallWithExplicit(isThisCall) } val result = JetFunctionCallUsage( elementToWorkWith, changeInfo.methodDescriptor.originalPrimaryFunction).processUsage(changeInfo, elementToWorkWith) - if (changeInfo.getNewParametersCount() == 0 && !isThisCall && !elementToWorkWith.isEmpty()) { + if (changeInfo.getNewParametersCount() == 0 && !isThisCall && !elementToWorkWith.isImplicit()) { (elementToWorkWith.getParent() as? JetSecondaryConstructor)?.getColon()?.delete() elementToWorkWith.replace(JetPsiFactory(element).createConstructorDelegationCall("")) }