Add modifier flags to descriptors

This commit is contained in:
Alexey Tsvetkov
2015-10-16 17:56:14 +03:00
parent ea40f8af92
commit c50aab6a75
32 changed files with 283 additions and 62 deletions
@@ -157,7 +157,11 @@ public class SingleAbstractMethodUtils {
assert parameterType != null : "couldn't substitute type: " + parameterTypeUnsubstituted +
", substitutor = " + typeParameters.substitutor;
ValueParameterDescriptor parameter = new ValueParameterDescriptorImpl(
result, null, 0, Annotations.Companion.getEMPTY(), Name.identifier("function"), parameterType, false, null, SourceElement.NO_SOURCE);
result, null, 0, Annotations.Companion.getEMPTY(), Name.identifier("function"), parameterType,
/* declaresDefaultValue = */ false,
/* isCrossinline = */ false,
/* isNoinline = */ false,
null, SourceElement.NO_SOURCE);
JetType returnType = typeParameters.substitutor.substitute(samInterface.getDefaultType(), Variance.OUT_VARIANCE);
assert returnType != null : "couldn't substitute type: " + samInterface.getDefaultType() +
@@ -268,7 +272,11 @@ public class SingleAbstractMethodUtils {
ValueParameterDescriptor newParam = new ValueParameterDescriptorImpl(
samAdapter, null, originalParam.getIndex(), originalParam.getAnnotations(),
originalParam.getName(), newType, false, null, SourceElement.NO_SOURCE
originalParam.getName(), newType,
/* declaresDefaultValue = */ false,
/* isCrossinline = */ false,
/* isNoinline = */ false,
null, SourceElement.NO_SOURCE
);
valueParameters.add(newParam);
}
@@ -229,6 +229,8 @@ public class AlternativeMethodSignatureData extends ElementAlternativeSignatureD
altName != null ? altName : originalParameterDescriptor.getName(),
alternativeType,
originalParameterDescriptor.declaresDefaultValue(),
originalParameterDescriptor.isCrossinline(),
originalParameterDescriptor.isNoinline(),
alternativeVarargElementType,
SourceElement.NO_SOURCE
));
@@ -266,6 +266,8 @@ public class SignaturesPropagationData {
stableName != null ? stableName : originalParam.getName(),
altType,
originalParam.declaresDefaultValue(),
originalParam.isCrossinline(),
originalParam.isNoinline(),
varargCheckResult.isVararg ? DescriptorUtilsKt.getBuiltIns(originalParam).getArrayElementType(altType) : null,
SourceElement.NO_SOURCE
));
@@ -281,6 +281,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : JetScopeImp
visibility,
false,
false,
getMethod.isExternal,
CallableMemberDescriptor.Kind.SYNTHESIZED,
null,
SourceElement.NO_SOURCE)
@@ -293,6 +294,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : JetScopeImp
syntheticExtensionVisibility(setMethod),
false,
false,
setMethod.isExternal,
CallableMemberDescriptor.Kind.SYNTHESIZED,
null,
SourceElement.NO_SOURCE)
@@ -30,9 +30,7 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.resolve.scopes.JetScope
import org.jetbrains.kotlin.storage.StorageManager
import org.jetbrains.kotlin.types.*
import java.util.ArrayList
import java.util.HashMap
import java.util.LinkedHashSet
import java.util.*
import kotlin.properties.Delegates
interface SamAdapterExtensionFunctionDescriptor : FunctionDescriptor {
@@ -151,6 +149,9 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : JetScope by Jet
newVisibility: Visibility,
newIsOperator: Boolean,
newIsInfix: Boolean,
newIsExternal: Boolean,
newIsInline: Boolean,
newIsTailrec: Boolean,
original: FunctionDescriptor?,
copyOverrides: Boolean,
kind: CallableMemberDescriptor.Kind,
@@ -159,7 +160,8 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : JetScope by Jet
newReturnType: JetType
): FunctionDescriptor? {
val descriptor = super<SimpleFunctionDescriptorImpl>.doSubstitute(
originalSubstitutor, newOwner, newModality, newVisibility, newIsOperator, newIsInfix, original,
originalSubstitutor, newOwner, newModality, newVisibility,
newIsOperator, newIsInfix, newIsExternal, newIsInline, newIsTailrec, original,
copyOverrides, kind, newValueParameterDescriptors, newExtensionReceiverParameterType, newReturnType)
as MyFunctionDescriptor? ?: return null