Skip to content

Commit

Permalink
Removed isVar field & constructor parameter from ValueParameterDescri…
Browse files Browse the repository at this point in the history
…ptorImpl, since it's always false.
  • Loading branch information
Evgeny Gerashchenko authored and Evgeny Gerashchenko committed Mar 14, 2013
1 parent 82bff79 commit fa5fcbb
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 22 deletions.
Expand Up @@ -201,7 +201,6 @@ private void computeValueParameters(JavaDescriptorResolver.ValueParameterDescrip
originalParameterDescriptor.getIndex(),
originalParameterDescriptor.getAnnotations(),
originalParameterDescriptor.getName(),
originalParameterDescriptor.isVar(),
alternativeType,
originalParameterDescriptor.declaresDefaultValue(),
alternativeVarargElementType));
Expand Down
Expand Up @@ -179,7 +179,6 @@ public TypeAndVariance fun(FunctionDescriptor superFunction) {
index,
originalParam.getAnnotations(),
originalParam.getName(),
originalParam.isVar(),
altType,
originalParam.declaresDefaultValue(),
varargCheckResult.isVararg ? KotlinBuiltIns.getInstance().getArrayElementType(altType) : null
Expand Down
Expand Up @@ -132,7 +132,6 @@ else if (psiConstructors.length == 0) {
i,
Collections.<AnnotationDescriptor>emptyList(),
Name.identifier(method.getName()),
false,
typeTransformer.transformToType(returnType, resolverForTypeParameters),
annotationMethod.getDefaultValue() != null,
varargElementType));
Expand Down
Expand Up @@ -282,7 +282,6 @@ private static void initializeSetterAndGetter(
0,
Collections.<AnnotationDescriptor>emptyList(),
Name.identifier("p0") /*TODO*/,
false,
propertyDescriptor.getType(),
false,
null));
Expand Down
Expand Up @@ -102,7 +102,6 @@ private JvmMethodParameterMeaning resolveParameterDescriptor(
i,
Collections.<AnnotationDescriptor>emptyList(), // TODO
name,
false,
transformedType,
hasDefaultValue,
varargElementType
Expand Down
Expand Up @@ -80,7 +80,6 @@ public static List<ValueParameterDescriptor> getSubstitutedValueParameters(Funct
substitutedDescriptor,
unsubstitutedValueParameter,
unsubstitutedValueParameter.getAnnotations(),
unsubstitutedValueParameter.isVar(),
substitutedType,
substituteVarargElementType
));
Expand Down
Expand Up @@ -67,7 +67,7 @@ public void initialize(@NotNull ValueParameterDescriptor parameter) {

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
Expand Down
Expand Up @@ -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;

Expand All @@ -48,23 +47,21 @@ public ValueParameterDescriptorImpl(
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
) {
Expand All @@ -73,7 +70,6 @@ public ValueParameterDescriptorImpl(
this.index = original.getIndex();
this.declaresDefaultValue = original.declaresDefaultValue();
this.varargElementType = varargElementType;
this.isVar = isVar;
}

@Override
Expand Down Expand Up @@ -138,13 +134,13 @@ public <R, D> R accept(DeclarationDescriptorVisitor<R, D> visitor, D data) {

@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
Expand Down
Expand Up @@ -381,7 +381,7 @@ public static SimpleFunctionDescriptor createCopyFunctionDescriptor(
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);
Expand Down Expand Up @@ -485,7 +485,6 @@ public MutableValueParameterDescriptor resolveValueParameterDescriptor(
index,
annotationResolver.resolveAnnotations(scope, valueParameter.getModifierList(), trace),
JetPsiUtil.safeName(valueParameter.getName()),
false,
variableType,
valueParameter.getDefaultValue() != null,
varargElementType
Expand Down Expand Up @@ -1355,7 +1354,6 @@ protected JetType compute() {
0,
Collections.<AnnotationDescriptor>emptyList(),
Name.identifier("value"),
false,
KotlinBuiltIns.getInstance().getStringType(),
false,
null);
Expand Down
Expand Up @@ -108,7 +108,7 @@ private ValueParameterDescriptor resolveScriptParameter(
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) {
Expand Down
Expand Up @@ -198,7 +198,6 @@ private static List<ValueParameterDescriptor> getValueParameters(FunctionDescrip
i,
Collections.<AnnotationDescriptor>emptyList(),
Name.special("<ERROR VALUE_PARAMETER>"),
true,
ERROR_PARAMETER_TYPE,
false,
null));
Expand Down
Expand Up @@ -171,7 +171,7 @@ private static List<ValueParameterDescriptor> createValueParameterDescriptors(
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);
Expand Down
Expand Up @@ -873,7 +873,7 @@ public List<ValueParameterDescriptor> getValueParameters(@NotNull FunctionDescri
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;
Expand Down

0 comments on commit fa5fcbb

Please sign in to comment.