Add 'preserveSource' parameter to methods making substitution copies

This commit is contained in:
Denis Zharkov
2015-10-26 10:50:59 +03:00
parent dd46056784
commit 80bf7316c7
12 changed files with 55 additions and 30 deletions
@@ -55,7 +55,8 @@ import org.jetbrains.kotlin.name.Name;
@NotNull DeclarationDescriptor newOwner,
@Nullable FunctionDescriptor original,
@NotNull Kind kind,
@Nullable Name newName
@Nullable Name newName,
boolean preserveSource
) {
return new SamAdapterFunctionDescriptor(newOwner, (SimpleFunctionDescriptor) original, kind, declaration);
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.synthetic
import com.intellij.util.SmartList
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
import org.jetbrains.kotlin.incremental.components.LookupLocation
import org.jetbrains.kotlin.load.java.sam.SingleAbstractMethodUtils
@@ -145,7 +146,8 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : BaseImportingSc
newOwner: DeclarationDescriptor,
original: FunctionDescriptor?,
kind: CallableMemberDescriptor.Kind,
newName: Name?
newName: Name?,
preserveSource: Boolean
): MyFunctionDescriptor {
return MyFunctionDescriptor(
containingDeclaration, original as SimpleFunctionDescriptor?, annotations, newName ?: name, kind, source
@@ -170,12 +172,13 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : BaseImportingSc
newValueParameterDescriptors: MutableList<ValueParameterDescriptor>,
newExtensionReceiverParameterType: KotlinType?,
newReturnType: KotlinType,
name: Name?
name: Name?,
preserveSource: Boolean
): FunctionDescriptor? {
val descriptor = super.doSubstitute(
originalSubstitutor, newOwner, newModality, newVisibility,
newIsOperator, newIsInfix, newIsExternal, newIsInline, newIsTailrec, original,
copyOverrides, kind, newValueParameterDescriptors, newExtensionReceiverParameterType, newReturnType, name)
copyOverrides, kind, newValueParameterDescriptors, newExtensionReceiverParameterType, newReturnType, name, preserveSource)
as MyFunctionDescriptor? ?: return null
if (original == null) {