Got rid of conustructors zoo in value parameter and getter/setter descriptors.
This commit is contained in:
@@ -55,16 +55,14 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl {
|
|||||||
public Getter(AccessorForPropertyDescriptor property) {
|
public Getter(AccessorForPropertyDescriptor property) {
|
||||||
super(property, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
|
super(property, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
|
||||||
false,
|
false,
|
||||||
false, Kind.DECLARATION);
|
false, Kind.DECLARATION, null);
|
||||||
initialize(property.getType());
|
initialize(property.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Setter extends PropertySetterDescriptorImpl {
|
public static class Setter extends PropertySetterDescriptorImpl {
|
||||||
public Setter(AccessorForPropertyDescriptor property) {
|
public Setter(AccessorForPropertyDescriptor property) {
|
||||||
super(property, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
|
super(property, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL, false, false, Kind.DECLARATION, null);
|
||||||
false,
|
|
||||||
false, Kind.DECLARATION);
|
|
||||||
initializeDefault();
|
initializeDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -207,6 +207,7 @@ public class AlternativeMethodSignatureData extends ElementAlternativeSignatureD
|
|||||||
|
|
||||||
altParamDescriptors.add(new ValueParameterDescriptorImpl(
|
altParamDescriptors.add(new ValueParameterDescriptorImpl(
|
||||||
originalParameterDescriptor.getContainingDeclaration(),
|
originalParameterDescriptor.getContainingDeclaration(),
|
||||||
|
null,
|
||||||
originalParameterDescriptor.getIndex(),
|
originalParameterDescriptor.getIndex(),
|
||||||
originalParameterDescriptor.getAnnotations(),
|
originalParameterDescriptor.getAnnotations(),
|
||||||
altName != null ? altName : originalParameterDescriptor.getName(),
|
altName != null ? altName : originalParameterDescriptor.getName(),
|
||||||
|
|||||||
+1
@@ -222,6 +222,7 @@ public class SignaturesPropagationData {
|
|||||||
|
|
||||||
resultParameters.add(new ValueParameterDescriptorImpl(
|
resultParameters.add(new ValueParameterDescriptorImpl(
|
||||||
originalParam.getContainingDeclaration(),
|
originalParam.getContainingDeclaration(),
|
||||||
|
null,
|
||||||
shouldBeExtension ? originalIndex - 1 : originalIndex,
|
shouldBeExtension ? originalIndex - 1 : originalIndex,
|
||||||
originalParam.getAnnotations(),
|
originalParam.getAnnotations(),
|
||||||
stableName != null ? stableName : originalParam.getName(),
|
stableName != null ? stableName : originalParam.getName(),
|
||||||
|
|||||||
+11
-10
@@ -165,11 +165,11 @@ public class DescriptorDeserializer {
|
|||||||
int getterFlags = proto.getGetterFlags();
|
int getterFlags = proto.getGetterFlags();
|
||||||
boolean isNotDefault = proto.hasGetterFlags() && Flags.IS_NOT_DEFAULT.get(getterFlags);
|
boolean isNotDefault = proto.hasGetterFlags() && Flags.IS_NOT_DEFAULT.get(getterFlags);
|
||||||
if (isNotDefault) {
|
if (isNotDefault) {
|
||||||
getter = new PropertyGetterDescriptorImpl(
|
getter = new PropertyGetterDescriptorImpl(property,
|
||||||
property, getAnnotations(proto, getterFlags, AnnotatedCallableKind.PROPERTY_GETTER),
|
getAnnotations(proto, getterFlags, AnnotatedCallableKind.PROPERTY_GETTER),
|
||||||
modality(Flags.MODALITY.get(getterFlags)), visibility(Flags.VISIBILITY.get(getterFlags)),
|
modality(Flags.MODALITY.get(getterFlags)),
|
||||||
isNotDefault, !isNotDefault, property.getKind()
|
visibility(Flags.VISIBILITY.get(getterFlags)), isNotDefault, !isNotDefault,
|
||||||
);
|
property.getKind(), null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
getter = DescriptorFactory.createDefaultGetter(property);
|
getter = DescriptorFactory.createDefaultGetter(property);
|
||||||
@@ -181,11 +181,11 @@ public class DescriptorDeserializer {
|
|||||||
int setterFlags = proto.getSetterFlags();
|
int setterFlags = proto.getSetterFlags();
|
||||||
boolean isNotDefault = proto.hasSetterFlags() && Flags.IS_NOT_DEFAULT.get(setterFlags);
|
boolean isNotDefault = proto.hasSetterFlags() && Flags.IS_NOT_DEFAULT.get(setterFlags);
|
||||||
if (isNotDefault) {
|
if (isNotDefault) {
|
||||||
setter = new PropertySetterDescriptorImpl(
|
setter = new PropertySetterDescriptorImpl(property,
|
||||||
property, getAnnotations(proto, setterFlags, AnnotatedCallableKind.PROPERTY_SETTER),
|
getAnnotations(proto, setterFlags, AnnotatedCallableKind.PROPERTY_SETTER),
|
||||||
modality(Flags.MODALITY.get(setterFlags)), visibility(Flags.VISIBILITY.get(setterFlags)),
|
modality(Flags.MODALITY.get(setterFlags)),
|
||||||
isNotDefault, !isNotDefault, property.getKind()
|
visibility(Flags.VISIBILITY.get(setterFlags)), isNotDefault, !isNotDefault,
|
||||||
);
|
property.getKind(), null);
|
||||||
DescriptorDeserializer setterLocal = local.createChildDeserializer(setter, Collections.<TypeParameter>emptyList(),
|
DescriptorDeserializer setterLocal = local.createChildDeserializer(setter, Collections.<TypeParameter>emptyList(),
|
||||||
Collections.<TypeParameterDescriptor>emptyList());
|
Collections.<TypeParameterDescriptor>emptyList());
|
||||||
List<ValueParameterDescriptor> valueParameters = setterLocal.valueParameters(proto, AnnotatedCallableKind.PROPERTY_SETTER);
|
List<ValueParameterDescriptor> valueParameters = setterLocal.valueParameters(proto, AnnotatedCallableKind.PROPERTY_SETTER);
|
||||||
@@ -401,6 +401,7 @@ public class DescriptorDeserializer {
|
|||||||
Callable.ValueParameter proto = protos.get(i);
|
Callable.ValueParameter proto = protos.get(i);
|
||||||
result.add(new ValueParameterDescriptorImpl(
|
result.add(new ValueParameterDescriptorImpl(
|
||||||
containingDeclaration,
|
containingDeclaration,
|
||||||
|
null,
|
||||||
i,
|
i,
|
||||||
getAnnotations(classOrPackage, callable, kind, proto),
|
getAnnotations(classOrPackage, callable, kind, proto),
|
||||||
nameResolver.getName(proto.getName()),
|
nameResolver.getName(proto.getName()),
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ public class DescriptorResolver {
|
|||||||
// If parameter hasn't corresponding property, so it mustn't have default value as a parameter in copy function for data class
|
// If parameter hasn't corresponding property, so it mustn't have default value as a parameter in copy function for data class
|
||||||
boolean declaresDefaultValue = propertyDescriptor != null;
|
boolean declaresDefaultValue = propertyDescriptor != null;
|
||||||
ValueParameterDescriptorImpl parameterDescriptor =
|
ValueParameterDescriptorImpl parameterDescriptor =
|
||||||
new ValueParameterDescriptorImpl(functionDescriptor, parameter.getIndex(), parameter.getAnnotations(),
|
new ValueParameterDescriptorImpl(functionDescriptor, null, parameter.getIndex(), parameter.getAnnotations(),
|
||||||
parameter.getName(), parameter.getType(),
|
parameter.getName(), parameter.getType(),
|
||||||
declaresDefaultValue,
|
declaresDefaultValue,
|
||||||
parameter.getVarargElementType());
|
parameter.getVarargElementType());
|
||||||
@@ -546,6 +546,7 @@ public class DescriptorResolver {
|
|||||||
}
|
}
|
||||||
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(
|
||||||
declarationDescriptor,
|
declarationDescriptor,
|
||||||
|
null,
|
||||||
index,
|
index,
|
||||||
annotations,
|
annotations,
|
||||||
JetPsiUtil.safeName(valueParameter.getName()),
|
JetPsiUtil.safeName(valueParameter.getName()),
|
||||||
@@ -1127,11 +1128,11 @@ public class DescriptorResolver {
|
|||||||
annotationResolver.resolveAnnotationsWithoutArguments(scope, setter.getModifierList(), trace);
|
annotationResolver.resolveAnnotationsWithoutArguments(scope, setter.getModifierList(), trace);
|
||||||
JetParameter parameter = setter.getParameter();
|
JetParameter parameter = setter.getParameter();
|
||||||
|
|
||||||
setterDescriptor = new PropertySetterDescriptorImpl(
|
setterDescriptor = new PropertySetterDescriptorImpl(propertyDescriptor, annotations,
|
||||||
propertyDescriptor, annotations,
|
resolveModalityFromModifiers(setter, propertyDescriptor.getModality()),
|
||||||
resolveModalityFromModifiers(setter, propertyDescriptor.getModality()),
|
resolveVisibilityFromModifiers(setter, propertyDescriptor.getVisibility()),
|
||||||
resolveVisibilityFromModifiers(setter, propertyDescriptor.getVisibility()),
|
setter.getBodyExpression() != null, false,
|
||||||
setter.getBodyExpression() != null, false, CallableMemberDescriptor.Kind.DECLARATION);
|
CallableMemberDescriptor.Kind.DECLARATION, null);
|
||||||
if (parameter != null) {
|
if (parameter != null) {
|
||||||
|
|
||||||
// This check is redundant: the parser does not allow a default value, but we'll keep it just in case
|
// This check is redundant: the parser does not allow a default value, but we'll keep it just in case
|
||||||
@@ -1204,11 +1205,11 @@ public class DescriptorResolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getterDescriptor = new PropertyGetterDescriptorImpl(
|
getterDescriptor = new PropertyGetterDescriptorImpl(propertyDescriptor, annotations,
|
||||||
propertyDescriptor, annotations,
|
resolveModalityFromModifiers(getter, propertyDescriptor.getModality()),
|
||||||
resolveModalityFromModifiers(getter, propertyDescriptor.getModality()),
|
resolveVisibilityFromModifiers(getter, propertyDescriptor.getVisibility()),
|
||||||
resolveVisibilityFromModifiers(getter, propertyDescriptor.getVisibility()),
|
getter.getBodyExpression() != null, false,
|
||||||
getter.getBodyExpression() != null, false, CallableMemberDescriptor.Kind.DECLARATION);
|
CallableMemberDescriptor.Kind.DECLARATION, null);
|
||||||
getterDescriptor.initialize(returnType);
|
getterDescriptor.initialize(returnType);
|
||||||
trace.record(BindingContext.PROPERTY_ACCESSOR, getter, getterDescriptor);
|
trace.record(BindingContext.PROPERTY_ACCESSOR, getter, getterDescriptor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ public class FunctionDescriptorUtil {
|
|||||||
|
|
||||||
parameters.add(new ValueParameterDescriptorImpl(
|
parameters.add(new ValueParameterDescriptorImpl(
|
||||||
descriptor,
|
descriptor,
|
||||||
|
null,
|
||||||
idx,
|
idx,
|
||||||
parameter.getAnnotations(),
|
parameter.getAnnotations(),
|
||||||
parameter.getName(),
|
parameter.getName(),
|
||||||
|
|||||||
@@ -100,7 +100,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, Annotations.EMPTY, scriptParameter.getName(), type, false, null);
|
return new ValueParameterDescriptorImpl(script, null, index, Annotations.EMPTY, scriptParameter.getName(), type, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processScriptHierarchy(@NotNull TopDownAnalysisContext c, @NotNull JetScript script, @NotNull JetScope outerScope) {
|
public void processScriptHierarchy(@NotNull TopDownAnalysisContext c, @NotNull JetScript script, @NotNull JetScope outerScope) {
|
||||||
|
|||||||
+1
-1
@@ -228,7 +228,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, Annotations.EMPTY, Name.identifier("it"),
|
functionDescriptor, null, 0, Annotations.EMPTY, Name.identifier("it"),
|
||||||
valueParameterDescriptor.getType(), valueParameterDescriptor.hasDefaultValue(), valueParameterDescriptor.getVarargElementType()
|
valueParameterDescriptor.getType(), valueParameterDescriptor.hasDefaultValue(), valueParameterDescriptor.getVarargElementType()
|
||||||
);
|
);
|
||||||
valueParameterDescriptors.add(it);
|
valueParameterDescriptors.add(it);
|
||||||
|
|||||||
+1
-1
@@ -106,7 +106,7 @@ public class ControlStructureTypingUtils {
|
|||||||
for (int i = 0; i < argumentNames.size(); i++) {
|
for (int i = 0; i < argumentNames.size(); i++) {
|
||||||
JetType argumentType = isArgumentNullable.get(i) ? nullableType : type;
|
JetType argumentType = isArgumentNullable.get(i) ? nullableType : type;
|
||||||
ValueParameterDescriptorImpl valueParameter = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptorImpl valueParameter = new ValueParameterDescriptorImpl(
|
||||||
function, i, Annotations.EMPTY, Name.identifier(argumentNames.get(i)), argumentType, false, null);
|
function, null, i, Annotations.EMPTY, Name.identifier(argumentNames.get(i)), argumentType, false, null);
|
||||||
valueParameters.add(valueParameter);
|
valueParameters.add(valueParameter);
|
||||||
}
|
}
|
||||||
function.initialize(
|
function.initialize(
|
||||||
|
|||||||
+1
@@ -148,6 +148,7 @@ public class LazyJavaClassMemberScope(
|
|||||||
|
|
||||||
result.add(ValueParameterDescriptorImpl(
|
result.add(ValueParameterDescriptorImpl(
|
||||||
constructor,
|
constructor,
|
||||||
|
null,
|
||||||
index,
|
index,
|
||||||
Annotations.EMPTY,
|
Annotations.EMPTY,
|
||||||
method.getName(),
|
method.getName(),
|
||||||
|
|||||||
+1
@@ -210,6 +210,7 @@ public abstract class LazyJavaMemberScope(
|
|||||||
|
|
||||||
ValueParameterDescriptorImpl(
|
ValueParameterDescriptorImpl(
|
||||||
function,
|
function,
|
||||||
|
null,
|
||||||
index,
|
index,
|
||||||
c.resolveAnnotations(javaParameter),
|
c.resolveAnnotations(javaParameter),
|
||||||
name,
|
name,
|
||||||
|
|||||||
+2
-2
@@ -147,7 +147,7 @@ public class SingleAbstractMethodUtils {
|
|||||||
assert parameterType != null : "couldn't substitute type: " + parameterTypeUnsubstituted +
|
assert parameterType != null : "couldn't substitute type: " + parameterTypeUnsubstituted +
|
||||||
", substitutor = " + typeParameters.substitutor;
|
", substitutor = " + typeParameters.substitutor;
|
||||||
ValueParameterDescriptor parameter = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptor parameter = new ValueParameterDescriptorImpl(
|
||||||
result, 0, Annotations.EMPTY, Name.identifier("function"), parameterType, false, null);
|
result, null, 0, Annotations.EMPTY, Name.identifier("function"), parameterType, false, null);
|
||||||
|
|
||||||
JetType returnType = typeParameters.substitutor.substitute(samInterface.getDefaultType(), Variance.OUT_VARIANCE);
|
JetType returnType = typeParameters.substitutor.substitute(samInterface.getDefaultType(), Variance.OUT_VARIANCE);
|
||||||
assert returnType != null : "couldn't substitute type: " + samInterface.getDefaultType() +
|
assert returnType != null : "couldn't substitute type: " + samInterface.getDefaultType() +
|
||||||
@@ -251,7 +251,7 @@ public class SingleAbstractMethodUtils {
|
|||||||
assert newType != null : "couldn't substitute type: " + newTypeUnsubstituted + ", substitutor = " + typeParameters.substitutor;
|
assert newType != null : "couldn't substitute type: " + newTypeUnsubstituted + ", substitutor = " + typeParameters.substitutor;
|
||||||
|
|
||||||
ValueParameterDescriptor newParam = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptor newParam = new ValueParameterDescriptorImpl(
|
||||||
adapter, originalParam.getIndex(), originalParam.getAnnotations(), originalParam.getName(), newType, false, null);
|
adapter, null, originalParam.getIndex(), originalParam.getAnnotations(), originalParam.getName(), newType, false, null);
|
||||||
valueParameters.add(newParam);
|
valueParameters.add(newParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -265,10 +265,13 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
result.add(new ValueParameterDescriptorImpl(
|
result.add(new ValueParameterDescriptorImpl(
|
||||||
substitutedDescriptor,
|
substitutedDescriptor,
|
||||||
unsubstitutedValueParameter,
|
unsubstitutedValueParameter,
|
||||||
|
unsubstitutedValueParameter.getIndex(),
|
||||||
unsubstitutedValueParameter.getAnnotations(),
|
unsubstitutedValueParameter.getAnnotations(),
|
||||||
|
unsubstitutedValueParameter.getName(),
|
||||||
substitutedType,
|
substitutedType,
|
||||||
substituteVarargElementType
|
unsubstitutedValueParameter.declaresDefaultValue(),
|
||||||
));
|
substituteVarargElementType)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -62,7 +62,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr
|
|||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull Kind kind
|
@NotNull Kind kind
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, annotations, name);
|
super(containingDeclaration, annotations, name, null);
|
||||||
this.isVar = isVar;
|
this.isVar = isVar;
|
||||||
this.modality = modality;
|
this.modality = modality;
|
||||||
this.visibility = visibility;
|
this.visibility = visibility;
|
||||||
@@ -70,6 +70,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr
|
|||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
public static PropertyDescriptorImpl create(
|
public static PropertyDescriptorImpl create(
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
|
|||||||
-12
@@ -33,18 +33,6 @@ public class PropertyGetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
|||||||
@NotNull
|
@NotNull
|
||||||
private final PropertyGetterDescriptor original;
|
private final PropertyGetterDescriptor original;
|
||||||
|
|
||||||
public PropertyGetterDescriptorImpl(
|
|
||||||
@NotNull PropertyDescriptor correspondingProperty,
|
|
||||||
@NotNull Annotations annotations,
|
|
||||||
@NotNull Modality modality,
|
|
||||||
@NotNull Visibility visibility,
|
|
||||||
boolean hasBody,
|
|
||||||
boolean isDefault,
|
|
||||||
@NotNull Kind kind
|
|
||||||
) {
|
|
||||||
this(correspondingProperty, annotations, modality, visibility, hasBody, isDefault, kind, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PropertyGetterDescriptorImpl(
|
public PropertyGetterDescriptorImpl(
|
||||||
@NotNull PropertyDescriptor correspondingProperty,
|
@NotNull PropertyDescriptor correspondingProperty,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
|
|||||||
+1
-13
@@ -35,18 +35,6 @@ public class PropertySetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
|||||||
@NotNull
|
@NotNull
|
||||||
private final PropertySetterDescriptor original;
|
private final PropertySetterDescriptor original;
|
||||||
|
|
||||||
public PropertySetterDescriptorImpl(
|
|
||||||
@NotNull PropertyDescriptor correspondingProperty,
|
|
||||||
@NotNull Annotations annotations,
|
|
||||||
@NotNull Modality modality,
|
|
||||||
@NotNull Visibility visibility,
|
|
||||||
boolean hasBody,
|
|
||||||
boolean isDefault,
|
|
||||||
@NotNull Kind kind
|
|
||||||
) {
|
|
||||||
this(correspondingProperty, annotations, modality, visibility, hasBody, isDefault, kind, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PropertySetterDescriptorImpl(
|
public PropertySetterDescriptorImpl(
|
||||||
@NotNull PropertyDescriptor correspondingProperty,
|
@NotNull PropertyDescriptor correspondingProperty,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@@ -76,7 +64,7 @@ public class PropertySetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
|||||||
@NotNull JetType type
|
@NotNull JetType type
|
||||||
) {
|
) {
|
||||||
return new ValueParameterDescriptorImpl(
|
return new ValueParameterDescriptorImpl(
|
||||||
setterDescriptor, 0, Annotations.EMPTY, Name.special("<set-?>"), type, false, null
|
setterDescriptor, null, 0, Annotations.EMPTY, Name.special("<set-?>"), type, false, null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-16
@@ -42,6 +42,7 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
|||||||
|
|
||||||
public ValueParameterDescriptorImpl(
|
public ValueParameterDescriptorImpl(
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
|
@Nullable ValueParameterDescriptor original,
|
||||||
int index,
|
int index,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@@ -50,26 +51,12 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
|||||||
@Nullable JetType varargElementType
|
@Nullable JetType varargElementType
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, annotations, name, outType);
|
super(containingDeclaration, annotations, name, outType);
|
||||||
this.original = this;
|
this.original = original == null ? this : original;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.declaresDefaultValue = declaresDefaultValue;
|
this.declaresDefaultValue = declaresDefaultValue;
|
||||||
this.varargElementType = varargElementType;
|
this.varargElementType = varargElementType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueParameterDescriptorImpl(
|
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
|
||||||
@NotNull ValueParameterDescriptor original,
|
|
||||||
@NotNull Annotations annotations,
|
|
||||||
@NotNull JetType outType,
|
|
||||||
@Nullable JetType varargElementType
|
|
||||||
) {
|
|
||||||
super(containingDeclaration, annotations, original.getName(), outType);
|
|
||||||
this.original = original;
|
|
||||||
this.index = original.getIndex();
|
|
||||||
this.declaresDefaultValue = original.declaresDefaultValue();
|
|
||||||
this.varargElementType = varargElementType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(@NotNull JetType type) {
|
public void setType(@NotNull JetType type) {
|
||||||
setOutType(type);
|
setOutType(type);
|
||||||
}
|
}
|
||||||
@@ -138,7 +125,7 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public ValueParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner, @NotNull Name newName) {
|
public ValueParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner, @NotNull Name newName) {
|
||||||
return new ValueParameterDescriptorImpl(newOwner, index, getAnnotations(), newName, getType(), declaresDefaultValue(), varargElementType);
|
return new ValueParameterDescriptorImpl(newOwner, null, index, getAnnotations(), newName, getType(), declaresDefaultValue(), varargElementType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
-9
@@ -43,15 +43,6 @@ public abstract class VariableDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
this.outType = outType;
|
this.outType = outType;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected VariableDescriptorImpl(
|
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
|
||||||
@NotNull Annotations annotations,
|
|
||||||
@NotNull Name name
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this(containingDeclaration, annotations, name, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public JetType getType() {
|
public JetType getType() {
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ public class DescriptorFactory {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static PropertySetterDescriptorImpl createSetter(@NotNull PropertyDescriptor propertyDescriptor, boolean isDefault) {
|
public static PropertySetterDescriptorImpl createSetter(@NotNull PropertyDescriptor propertyDescriptor, boolean isDefault) {
|
||||||
PropertySetterDescriptorImpl setterDescriptor = new PropertySetterDescriptorImpl(
|
PropertySetterDescriptorImpl setterDescriptor =
|
||||||
propertyDescriptor, Annotations.EMPTY, propertyDescriptor.getModality(),
|
new PropertySetterDescriptorImpl(propertyDescriptor, Annotations.EMPTY, propertyDescriptor.getModality(),
|
||||||
propertyDescriptor.getVisibility(),
|
propertyDescriptor.getVisibility(), !isDefault, isDefault,
|
||||||
!isDefault, isDefault, CallableMemberDescriptor.Kind.DECLARATION);
|
CallableMemberDescriptor.Kind.DECLARATION, null);
|
||||||
setterDescriptor.initializeDefault();
|
setterDescriptor.initializeDefault();
|
||||||
return setterDescriptor;
|
return setterDescriptor;
|
||||||
}
|
}
|
||||||
@@ -68,10 +68,9 @@ public class DescriptorFactory {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static PropertyGetterDescriptorImpl createGetter(@NotNull PropertyDescriptor propertyDescriptor, boolean isDefault) {
|
public static PropertyGetterDescriptorImpl createGetter(@NotNull PropertyDescriptor propertyDescriptor, boolean isDefault) {
|
||||||
return new PropertyGetterDescriptorImpl(
|
return new PropertyGetterDescriptorImpl(propertyDescriptor, Annotations.EMPTY, propertyDescriptor.getModality(),
|
||||||
propertyDescriptor, Annotations.EMPTY, propertyDescriptor.getModality(),
|
propertyDescriptor.getVisibility(), !isDefault, isDefault,
|
||||||
propertyDescriptor.getVisibility(),
|
CallableMemberDescriptor.Kind.DECLARATION, null);
|
||||||
!isDefault, isDefault, CallableMemberDescriptor.Kind.DECLARATION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -107,6 +106,7 @@ public class DescriptorFactory {
|
|||||||
CallableMemberDescriptor.Kind.SYNTHESIZED);
|
CallableMemberDescriptor.Kind.SYNTHESIZED);
|
||||||
ValueParameterDescriptor parameterDescriptor = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptor parameterDescriptor = new ValueParameterDescriptorImpl(
|
||||||
values,
|
values,
|
||||||
|
null,
|
||||||
0,
|
0,
|
||||||
Annotations.EMPTY,
|
Annotations.EMPTY,
|
||||||
Name.identifier("value"),
|
Name.identifier("value"),
|
||||||
|
|||||||
@@ -853,7 +853,7 @@ public class KotlinBuiltIns {
|
|||||||
for (int i = 0; i < parameterTypes.size(); i++) {
|
for (int i = 0; i < parameterTypes.size(); i++) {
|
||||||
TypeProjection parameterType = parameterTypes.get(i);
|
TypeProjection parameterType = parameterTypes.get(i);
|
||||||
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(
|
||||||
functionDescriptor, i, Annotations.EMPTY,
|
functionDescriptor, null, i, Annotations.EMPTY,
|
||||||
Name.identifier("p" + (i + 1)), parameterType.getType(), false, null);
|
Name.identifier("p" + (i + 1)), parameterType.getType(), false, null);
|
||||||
valueParameters.add(valueParameterDescriptor);
|
valueParameters.add(valueParameterDescriptor);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user