Removed isVar field & constructor parameter from ValueParameterDescriptorImpl, since it's always false.

This commit is contained in:
Evgeny Gerashchenko
2013-03-11 22:23:32 +04:00
parent 82bff79c64
commit fa5fcbbad1
13 changed files with 9 additions and 22 deletions
@@ -201,7 +201,6 @@ public class AlternativeMethodSignatureData extends ElementAlternativeSignatureD
originalParameterDescriptor.getIndex(),
originalParameterDescriptor.getAnnotations(),
originalParameterDescriptor.getName(),
originalParameterDescriptor.isVar(),
alternativeType,
originalParameterDescriptor.declaresDefaultValue(),
alternativeVarargElementType));
@@ -179,7 +179,6 @@ public class SignaturesPropagationData {
index,
originalParam.getAnnotations(),
originalParam.getName(),
originalParam.isVar(),
altType,
originalParam.declaresDefaultValue(),
varargCheckResult.isVararg ? KotlinBuiltIns.getInstance().getArrayElementType(altType) : null
@@ -132,7 +132,6 @@ public final class JavaConstructorResolver {
i,
Collections.<AnnotationDescriptor>emptyList(),
Name.identifier(method.getName()),
false,
typeTransformer.transformToType(returnType, resolverForTypeParameters),
annotationMethod.getDefaultValue() != null,
varargElementType));
@@ -282,7 +282,6 @@ public final class JavaPropertyResolver {
0,
Collections.<AnnotationDescriptor>emptyList(),
Name.identifier("p0") /*TODO*/,
false,
propertyDescriptor.getType(),
false,
null));
@@ -102,7 +102,6 @@ public final class JavaValueParameterResolver {
i,
Collections.<AnnotationDescriptor>emptyList(), // TODO
name,
false,
transformedType,
hasDefaultValue,
varargElementType
@@ -80,7 +80,6 @@ public class FunctionDescriptorUtil {
substitutedDescriptor,
unsubstitutedValueParameter,
unsubstitutedValueParameter.getAnnotations(),
unsubstitutedValueParameter.isVar(),
substitutedType,
substituteVarargElementType
));
@@ -67,7 +67,7 @@ public class PropertySetterDescriptorImpl extends PropertyAccessorDescriptorImpl
public void initializeDefault() {
assert parameter == null;
parameter = new ValueParameterDescriptorImpl(this, 0, Collections.<AnnotationDescriptor>emptyList(), Name.special("<set-?>"), false, getCorrespondingProperty().getReturnType(), false, null);
parameter = new ValueParameterDescriptorImpl(this, 0, Collections.<AnnotationDescriptor>emptyList(), Name.special("<set-?>"), getCorrespondingProperty().getReturnType(), false, null);
}
@NotNull
@@ -35,7 +35,6 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
private final boolean declaresDefaultValue;
private final JetType varargElementType;
private final boolean isVar;
private final int index;
private final ValueParameterDescriptor original;
@@ -48,23 +47,21 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
int index,
@NotNull List<AnnotationDescriptor> annotations,
@NotNull Name name,
boolean isVar,
@NotNull JetType outType,
boolean declaresDefaultValue,
@Nullable JetType varargElementType) {
@Nullable JetType varargElementType
) {
super(containingDeclaration, annotations, name, outType);
this.original = this;
this.index = index;
this.declaresDefaultValue = declaresDefaultValue;
this.varargElementType = varargElementType;
this.isVar = isVar;
}
public ValueParameterDescriptorImpl(
@NotNull DeclarationDescriptor containingDeclaration,
@NotNull ValueParameterDescriptor original,
@NotNull List<AnnotationDescriptor> annotations,
boolean isVar,
@NotNull JetType outType,
@Nullable JetType varargElementType
) {
@@ -73,7 +70,6 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
this.index = original.getIndex();
this.declaresDefaultValue = original.declaresDefaultValue();
this.varargElementType = varargElementType;
this.isVar = isVar;
}
@Override
@@ -138,13 +134,13 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
@Override
public boolean isVar() {
return isVar;
return false;
}
@NotNull
@Override
public ValueParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner) {
return new ValueParameterDescriptorImpl(newOwner, index, Lists.newArrayList(getAnnotations()), getName(), isVar, getType(), hasDefaultValue, varargElementType);
return new ValueParameterDescriptorImpl(newOwner, index, Lists.newArrayList(getAnnotations()), getName(), getType(), hasDefaultValue, varargElementType);
}
@NotNull
@@ -381,7 +381,7 @@ public class DescriptorResolver {
boolean declaresDefaultValue = propertyDescriptor != null;
ValueParameterDescriptorImpl parameterDescriptor =
new ValueParameterDescriptorImpl(functionDescriptor, parameter.getIndex(), parameter.getAnnotations(),
parameter.getName(), parameter.isVar(), parameter.getType(),
parameter.getName(), parameter.getType(),
declaresDefaultValue,
parameter.getVarargElementType());
parameterDescriptors.add(parameterDescriptor);
@@ -485,7 +485,6 @@ public class DescriptorResolver {
index,
annotationResolver.resolveAnnotations(scope, valueParameter.getModifierList(), trace),
JetPsiUtil.safeName(valueParameter.getName()),
false,
variableType,
valueParameter.getDefaultValue() != null,
varargElementType
@@ -1355,7 +1354,6 @@ public class DescriptorResolver {
0,
Collections.<AnnotationDescriptor>emptyList(),
Name.identifier("value"),
false,
KotlinBuiltIns.getInstance().getStringType(),
false,
null);
@@ -108,7 +108,7 @@ public class ScriptHeaderResolver {
int index,
@NotNull ScriptDescriptor script) {
JetType type = resolveTypeName(scriptParameter.getType());
return new ValueParameterDescriptorImpl(script, index, Collections.<AnnotationDescriptor>emptyList(), scriptParameter.getName(), false, type, false, null);
return new ValueParameterDescriptorImpl(script, index, Collections.<AnnotationDescriptor>emptyList(), scriptParameter.getName(), type, false, null);
}
public void processScriptHierarchy(@NotNull JetScript script, @NotNull JetScope outerScope) {
@@ -198,7 +198,6 @@ public class ErrorUtils {
i,
Collections.<AnnotationDescriptor>emptyList(),
Name.special("<ERROR VALUE_PARAMETER>"),
true,
ERROR_PARAMETER_TYPE,
false,
null));
@@ -171,7 +171,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
if (functionTypeExpected && !hasDeclaredValueParameters && expectedValueParameters.size() == 1) {
ValueParameterDescriptor valueParameterDescriptor = expectedValueParameters.get(0);
ValueParameterDescriptor it = new ValueParameterDescriptorImpl(
functionDescriptor, 0, Collections.<AnnotationDescriptor>emptyList(), Name.identifier("it"), false,
functionDescriptor, 0, Collections.<AnnotationDescriptor>emptyList(), Name.identifier("it"),
valueParameterDescriptor.getType(), valueParameterDescriptor.hasDefaultValue(), valueParameterDescriptor.getVarargElementType()
);
valueParameterDescriptors.add(it);
@@ -873,7 +873,7 @@ public class KotlinBuiltIns {
TypeProjection parameterType = parameterTypes.get(i);
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(
functionDescriptor, i, Collections.<AnnotationDescriptor>emptyList(),
Name.identifier("p" + (i + 1)), false, parameterType.getType(), false, null);
Name.identifier("p" + (i + 1)), parameterType.getType(), false, null);
valueParameters.add(valueParameterDescriptor);
}
return valueParameters;