Minor, Rename isEmpty -> isImplicit

This commit is contained in:
Denis Zharkov
2015-03-25 13:04:38 +03:00
parent 18e40d034e
commit b939530a5c
7 changed files with 18 additions and 19 deletions
@@ -418,7 +418,7 @@ public object PositioningStrategies {
public val SECONDARY_CONSTRUCTOR_DELEGATION_CALL: PositioningStrategy<JetConstructorDelegationCall> =
object : PositioningStrategy<JetConstructorDelegationCall>() {
override fun mark(element: JetConstructorDelegationCall): List<TextRange> {
if (element.isEmpty()) {
if (element.isImplicit()) {
val constructor = element.getStrictParentOfType<JetSecondaryConstructor>()!!
val valueParameterList = constructor.getValueParameterList() ?: return markElement(constructor)
return markRange(constructor.getConstructorKeyword(), valueParameterList.getLastChild())
@@ -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;
}
@@ -177,9 +177,8 @@ public class JetSecondaryConstructor extends JetDeclarationStub<KotlinPlaceHolde
return findChildByClass(JetConstructorDelegationCall.class);
}
public boolean hasEmptyDelegationCall() {
JetConstructorDelegationCall call = getDelegationCall();
return call.isEmpty();
public boolean hasImplicitDelegationCall() {
return getDelegationCall().isImplicit();
}
@NotNull
@@ -188,12 +187,12 @@ public class JetSecondaryConstructor extends JetDeclarationStub<KotlinPlaceHolde
}
@NotNull
public JetConstructorDelegationCall replaceEmptyDelegationCallWithExplicit(boolean isThis) {
public JetConstructorDelegationCall replaceImplicitDelegationCallWithExplicit(boolean isThis) {
JetPsiFactory psiFactory = new JetPsiFactory(getProject());
JetConstructorDelegationCall current = getDelegationCall();
assert current.isEmpty()
: "Method should not be called with non-existing or non-empty delegation call: " + getText();
assert current.isImplicit()
: "Method should not be called with explicit delegation call: " + getText();
current.delete();
PsiElement colon = addAfter(psiFactory.createColon(), getValueParameterList());
@@ -315,7 +315,7 @@ public class CallResolver {
if (call.getCalleeExpression() == null) return checkArgumentTypesAndFail(context);
if (constructorDescriptor.getContainingDeclaration().getKind() == ClassKind.ENUM_CLASS && call.isEmpty()) {
if (constructorDescriptor.getContainingDeclaration().getKind() == ClassKind.ENUM_CLASS && call.isImplicit()) {
return null;
}
@@ -374,8 +374,8 @@ public class CallResolver {
knownTypeParametersSubstitutor));
}
TracingStrategy tracing = call.isEmpty() ?
new TracingStrategyForEmptyConstructorDelegationCall(call, context.call) :
TracingStrategy tracing = call.isImplicit() ?
new TracingStrategyForImplicitConstructorDelegationCall(call, context.call) :
TracingStrategyImpl.create(calleeExpression, context.call);
return computeTasksFromCandidatesAndResolvedCall(context, candidates, CallTransformer.FUNCTION_CALL_TRANSFORMER, tracing);
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.types.ErrorUtils
import org.jetbrains.kotlin.types.JetType
public class TracingStrategyForEmptyConstructorDelegationCall(
public class TracingStrategyForImplicitConstructorDelegationCall(
val delegationCall: JetConstructorDelegationCall, call: Call
) : AbstractTracingStrategy(delegationCall.getCalleeExpression()!!, call) {