Introduce SimpleFunctionDescriptor.createCopyWithNewValueParameters
This commit is contained in:
@@ -19,6 +19,8 @@ package org.jetbrains.kotlin.descriptors;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple functions are the ones with 'fun' keyword and function literals
|
* Simple functions are the ones with 'fun' keyword and function literals
|
||||||
*/
|
*/
|
||||||
@@ -30,6 +32,9 @@ public interface SimpleFunctionDescriptor extends FunctionDescriptor {
|
|||||||
@NotNull
|
@NotNull
|
||||||
SimpleFunctionDescriptor createRenamedCopy(@NotNull Name name);
|
SimpleFunctionDescriptor createRenamedCopy(@NotNull Name name);
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
SimpleFunctionDescriptor createCopyWithNewValueParameters(@NotNull List<ValueParameterDescriptor> valueParameters);
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
SimpleFunctionDescriptor getOriginal();
|
SimpleFunctionDescriptor getOriginal();
|
||||||
|
|||||||
+10
@@ -115,4 +115,14 @@ public class SimpleFunctionDescriptorImpl extends FunctionDescriptorImpl impleme
|
|||||||
null, /* copyOverrides = */ true, getKind(), getValueParameters(), getExtensionReceiverParameterType(), getReturnType(), name
|
null, /* copyOverrides = */ true, getKind(), getValueParameters(), getExtensionReceiverParameterType(), getReturnType(), name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public SimpleFunctionDescriptor createCopyWithNewValueParameters(@NotNull List<ValueParameterDescriptor> valueParameters) {
|
||||||
|
return (SimpleFunctionDescriptorImpl) doSubstitute(
|
||||||
|
TypeSubstitutor.EMPTY, getContainingDeclaration(), getModality(), getVisibility(),
|
||||||
|
isOperator(), isInfix(), isExternal(), isInline(), isTailrec(),
|
||||||
|
null, /* copyOverrides = */ true, getKind(), valueParameters, getExtensionReceiverParameterType(), getReturnType(), null
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
@@ -25,6 +25,8 @@ import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl;
|
|||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.types.ErrorUtils;
|
import org.jetbrains.kotlin.types.ErrorUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ErrorSimpleFunctionDescriptorImpl extends SimpleFunctionDescriptorImpl {
|
public class ErrorSimpleFunctionDescriptorImpl extends SimpleFunctionDescriptorImpl {
|
||||||
// used for diagnostic only
|
// used for diagnostic only
|
||||||
@SuppressWarnings({"UnusedDeclaration", "FieldCanBeLocal"})
|
@SuppressWarnings({"UnusedDeclaration", "FieldCanBeLocal"})
|
||||||
@@ -58,6 +60,12 @@ public class ErrorSimpleFunctionDescriptorImpl extends SimpleFunctionDescriptorI
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public SimpleFunctionDescriptor createCopyWithNewValueParameters(@NotNull List<ValueParameterDescriptor> valueParameters) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addOverriddenDescriptor(@NotNull CallableMemberDescriptor overriddenFunction) {
|
public void addOverriddenDescriptor(@NotNull CallableMemberDescriptor overriddenFunction) {
|
||||||
// nop
|
// nop
|
||||||
|
|||||||
Reference in New Issue
Block a user