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