Implement copy in FunctionDescriptorImpl, call doSubstitute only in CopyConfiguration#build
This commit is contained in:
+4
-15
@@ -269,9 +269,10 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
ConstructorDescriptor primaryConstructor = getUnsubstitutedPrimaryConstructor();
|
||||
if (primaryConstructor != null) return primaryConstructor;
|
||||
|
||||
return new FunctionDescriptorImpl(LazyClassDescriptor.this, null, Annotations.Companion.getEMPTY(),
|
||||
Name.special("<init-blocks>"),
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE) {
|
||||
return new FunctionDescriptorImpl(
|
||||
LazyClassDescriptor.this, null, Annotations.Companion.getEMPTY(), Name.special("<init-blocks>"),
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE
|
||||
) {
|
||||
@NotNull
|
||||
@Override
|
||||
protected FunctionDescriptorImpl createSubstitutedCopy(
|
||||
@@ -284,18 +285,6 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FunctionDescriptor copy(
|
||||
DeclarationDescriptor newOwner,
|
||||
Modality modality,
|
||||
Visibility visibility,
|
||||
Kind kind,
|
||||
boolean copyOverrides
|
||||
) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+8
-10
@@ -156,15 +156,13 @@ public class ConstructorDescriptorImpl extends FunctionDescriptorImpl implements
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ConstructorDescriptor copy(DeclarationDescriptor newOwner, Modality modality, Visibility visibility, Kind kind, boolean copyOverrides) {
|
||||
//noinspection ConstantConditions
|
||||
return (ConstructorDescriptor) doSubstitute(
|
||||
(CopyConfiguration) newCopyBuilder()
|
||||
.setOwner(newOwner)
|
||||
.setModality(modality)
|
||||
.setVisibility(visibility)
|
||||
.setKind(kind)
|
||||
.setCopyOverrides(copyOverrides)
|
||||
);
|
||||
public ConstructorDescriptor copy(
|
||||
DeclarationDescriptor newOwner,
|
||||
Modality modality,
|
||||
Visibility visibility,
|
||||
Kind kind,
|
||||
boolean copyOverrides
|
||||
) {
|
||||
return (ConstructorDescriptor) super.copy(newOwner, modality, visibility, kind, copyOverrides);
|
||||
}
|
||||
}
|
||||
|
||||
+19
-1
@@ -315,7 +315,7 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
if (originalSubstitutor.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
return doSubstitute(newCopyBuilder(originalSubstitutor).setOriginal(getOriginal()));
|
||||
return newCopyBuilder(originalSubstitutor).setOriginal(getOriginal()).build();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -691,6 +691,24 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
return substitutedDescriptor;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FunctionDescriptor copy(
|
||||
DeclarationDescriptor newOwner,
|
||||
Modality modality,
|
||||
Visibility visibility,
|
||||
Kind kind,
|
||||
boolean copyOverrides
|
||||
) {
|
||||
return newCopyBuilder()
|
||||
.setOwner(newOwner)
|
||||
.setModality(modality)
|
||||
.setVisibility(visibility)
|
||||
.setKind(kind)
|
||||
.setCopyOverrides(copyOverrides)
|
||||
.build();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected abstract FunctionDescriptorImpl createSubstitutedCopy(
|
||||
@NotNull DeclarationDescriptor newOwner,
|
||||
|
||||
+1
-8
@@ -99,14 +99,7 @@ public class SimpleFunctionDescriptorImpl extends FunctionDescriptorImpl impleme
|
||||
Kind kind,
|
||||
boolean copyOverrides
|
||||
) {
|
||||
//noinspection ConstantConditions
|
||||
return newCopyBuilder()
|
||||
.setOwner(newOwner)
|
||||
.setModality(modality)
|
||||
.setVisibility(visibility)
|
||||
.setKind(kind)
|
||||
.setCopyOverrides(copyOverrides)
|
||||
.build();
|
||||
return (SimpleFunctionDescriptor) super.copy(newOwner, modality, visibility, kind, copyOverrides);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user