Add modifier flags to descriptors
This commit is contained in:
@@ -50,6 +50,9 @@ public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDe
|
||||
Visibilities.LOCAL);
|
||||
setOperator(descriptor.isOperator());
|
||||
setInfix(descriptor.isInfix());
|
||||
setExternal(descriptor.isExternal());
|
||||
setInline(descriptor.isInline());
|
||||
setTailrec(descriptor.isTailrec());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+6
-2
@@ -69,7 +69,9 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
|
||||
public static class Getter extends PropertyGetterDescriptorImpl implements AccessorForCallableDescriptor<PropertyGetterDescriptor> {
|
||||
public Getter(AccessorForPropertyDescriptor property) {
|
||||
super(property, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
|
||||
false, false, Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||
false, false,
|
||||
/* isExternal = */ false,
|
||||
Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||
initialize(property.getType());
|
||||
}
|
||||
|
||||
@@ -91,7 +93,9 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
|
||||
public static class Setter extends PropertySetterDescriptorImpl implements AccessorForCallableDescriptor<PropertySetterDescriptor>{
|
||||
public Setter(AccessorForPropertyDescriptor property) {
|
||||
super(property, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
|
||||
false, false, Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||
false, false,
|
||||
/* isExternal = */ false,
|
||||
Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||
initializeDefault();
|
||||
}
|
||||
|
||||
|
||||
+10
-2
@@ -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);
|
||||
}
|
||||
|
||||
+2
@@ -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
|
||||
));
|
||||
|
||||
+2
@@ -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
|
||||
));
|
||||
|
||||
+2
@@ -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)
|
||||
|
||||
+6
-4
@@ -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
|
||||
|
||||
|
||||
@@ -61,8 +61,7 @@ import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget.*;
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.*;
|
||||
import static org.jetbrains.kotlin.lexer.JetTokens.OVERRIDE_KEYWORD;
|
||||
import static org.jetbrains.kotlin.lexer.JetTokens.VARARG_KEYWORD;
|
||||
import static org.jetbrains.kotlin.lexer.JetTokens.*;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContext.*;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.ModifiersChecker.resolveModalityFromModifiers;
|
||||
@@ -278,6 +277,8 @@ public class DescriptorResolver {
|
||||
new ValueParameterDescriptorImpl(functionDescriptor, null, parameter.getIndex(), parameter.getAnnotations(),
|
||||
parameter.getName(), parameter.getType(),
|
||||
declaresDefaultValue,
|
||||
parameter.isCrossinline(),
|
||||
parameter.isNoinline(),
|
||||
parameter.getVarargElementType(), parameter.getSource());
|
||||
parameterDescriptors.add(parameterDescriptor);
|
||||
if (declaresDefaultValue) {
|
||||
@@ -366,6 +367,8 @@ public class DescriptorResolver {
|
||||
JetPsiUtil.safeName(valueParameter.getName()),
|
||||
variableType,
|
||||
valueParameter.hasDefaultValue(),
|
||||
valueParameter.hasModifier(CROSSINLINE_KEYWORD),
|
||||
valueParameter.hasModifier(NOINLINE_KEYWORD),
|
||||
varargElementType,
|
||||
KotlinSourceElementKt.toSourceElement(valueParameter)
|
||||
);
|
||||
@@ -1002,7 +1005,7 @@ public class DescriptorResolver {
|
||||
setterDescriptor = new PropertySetterDescriptorImpl(propertyDescriptor, annotations,
|
||||
resolveModalityFromModifiers(setter, propertyDescriptor.getModality()),
|
||||
resolveVisibilityFromModifiers(setter, propertyDescriptor.getVisibility()),
|
||||
setter.hasBody(), false,
|
||||
setter.hasBody(), false, setter.hasModifier(EXTERNAL_KEYWORD),
|
||||
CallableMemberDescriptor.Kind.DECLARATION, null, KotlinSourceElementKt
|
||||
.toSourceElement(setter));
|
||||
if (parameter != null) {
|
||||
@@ -1042,7 +1045,8 @@ public class DescriptorResolver {
|
||||
}
|
||||
else if (property.isVar()) {
|
||||
Annotations setterAnnotations = annotationSplitter.getAnnotationsForTarget(PROPERTY_SETTER);
|
||||
setterDescriptor = DescriptorFactory.createSetter(propertyDescriptor, setterAnnotations, !property.hasDelegate());
|
||||
setterDescriptor = DescriptorFactory.createSetter(propertyDescriptor, setterAnnotations, !property.hasDelegate(),
|
||||
/* isExternal = */ false);
|
||||
}
|
||||
|
||||
if (!property.isVar()) {
|
||||
@@ -1082,7 +1086,7 @@ public class DescriptorResolver {
|
||||
getterDescriptor = new PropertyGetterDescriptorImpl(propertyDescriptor, getterAnnotations,
|
||||
resolveModalityFromModifiers(getter, propertyDescriptor.getModality()),
|
||||
resolveVisibilityFromModifiers(getter, propertyDescriptor.getVisibility()),
|
||||
getter.hasBody(), false,
|
||||
getter.hasBody(), false, getter.hasModifier(EXTERNAL_KEYWORD),
|
||||
CallableMemberDescriptor.Kind.DECLARATION, null, KotlinSourceElementKt
|
||||
.toSourceElement(getter));
|
||||
getterDescriptor.initialize(returnType);
|
||||
@@ -1090,7 +1094,8 @@ public class DescriptorResolver {
|
||||
}
|
||||
else {
|
||||
Annotations getterAnnotations = annotationSplitter.getAnnotationsForTarget(PROPERTY_GETTER);
|
||||
getterDescriptor = DescriptorFactory.createGetter(propertyDescriptor, getterAnnotations, !property.hasDelegate());
|
||||
getterDescriptor = DescriptorFactory.createGetter(propertyDescriptor, getterAnnotations, !property.hasDelegate(),
|
||||
/* isExternal = */ false);
|
||||
getterDescriptor.initialize(propertyDescriptor.getType());
|
||||
}
|
||||
return getterDescriptor;
|
||||
|
||||
@@ -29,7 +29,9 @@ import org.jetbrains.kotlin.diagnostics.Errors.*
|
||||
import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.DescriptorResolver.*
|
||||
import org.jetbrains.kotlin.resolve.DescriptorResolver.getDefaultModality
|
||||
import org.jetbrains.kotlin.resolve.DescriptorResolver.getDefaultVisibility
|
||||
import org.jetbrains.kotlin.resolve.DescriptorResolver.transformAnonymousTypeIfNeeded
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.getDispatchReceiverParameterIfNeeded
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.isFunctionExpression
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.isFunctionLiteral
|
||||
@@ -178,6 +180,9 @@ class FunctionDescriptorResolver(
|
||||
)
|
||||
functionDescriptor.isOperator = function.hasModifier(JetTokens.OPERATOR_KEYWORD)
|
||||
functionDescriptor.isInfix = function.hasModifier(JetTokens.INFIX_KEYWORD)
|
||||
functionDescriptor.isExternal = function.hasModifier(JetTokens.EXTERNAL_KEYWORD)
|
||||
functionDescriptor.isInline = function.hasModifier(JetTokens.INLINE_KEYWORD)
|
||||
functionDescriptor.isTailrec = function.hasModifier(JetTokens.TAILREC_KEYWORD)
|
||||
receiverType?.let { ForceResolveUtil.forceResolveAllContents(it.getAnnotations()) }
|
||||
for (valueParameterDescriptor in valueParameterDescriptors) {
|
||||
ForceResolveUtil.forceResolveAllContents(valueParameterDescriptor.getType().getAnnotations())
|
||||
@@ -198,6 +203,7 @@ class FunctionDescriptorResolver(
|
||||
val valueParameterDescriptor = expectedValueParameters.first()
|
||||
val it = ValueParameterDescriptorImpl(functionDescriptor, null, 0, Annotations.EMPTY, Name.identifier("it"),
|
||||
valueParameterDescriptor.getType(), valueParameterDescriptor.declaresDefaultValue(),
|
||||
valueParameterDescriptor.isCrossinline, valueParameterDescriptor.isNoinline,
|
||||
valueParameterDescriptor.getVarargElementType(), SourceElement.NO_SOURCE)
|
||||
trace.record(BindingContext.AUTO_CREATED_IT, it)
|
||||
return listOf(it)
|
||||
|
||||
@@ -141,6 +141,8 @@ public class FunctionDescriptorUtil {
|
||||
parameter.getName(),
|
||||
returnType,
|
||||
parameter.declaresDefaultValue(),
|
||||
parameter.isCrossinline(),
|
||||
parameter.isNoinline(),
|
||||
parameter.getVarargElementType(),
|
||||
SourceElement.NO_SOURCE
|
||||
)
|
||||
@@ -158,6 +160,9 @@ public class FunctionDescriptorUtil {
|
||||
function.getVisibility());
|
||||
descriptor.setOperator(function.isOperator());
|
||||
descriptor.setInfix(function.isInfix());
|
||||
descriptor.setExternal(function.isExternal());
|
||||
descriptor.setInline(function.isInline());
|
||||
descriptor.setTailrec(function.isTailrec());
|
||||
return descriptor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.DescriptorFactory
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollector
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollectors
|
||||
@@ -166,7 +165,9 @@ class DynamicCallableDescriptors(private val builtIns: KotlinBuiltIns) {
|
||||
Annotations.EMPTY,
|
||||
arg.getArgumentName()?.asName ?: Name.identifier("p$index"),
|
||||
outType,
|
||||
false,
|
||||
/* declaresDefaultValue = */ false,
|
||||
/* isCrossinline = */ false,
|
||||
/* isNoinline = */ false,
|
||||
varargElementType,
|
||||
SourceElement.NO_SOURCE
|
||||
))
|
||||
|
||||
+5
-2
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
import java.util.ArrayList
|
||||
import java.util.*
|
||||
|
||||
fun createSynthesizedInvokes(functions: Collection<FunctionDescriptor>): Collection<FunctionDescriptor> {
|
||||
val result = ArrayList<FunctionDescriptor>(1)
|
||||
@@ -75,7 +75,7 @@ private fun createSynthesizedFunctionWithFirstParameterAsReceiver(descriptor: Fu
|
||||
original.getValueParameters().drop(1).map { p ->
|
||||
ValueParameterDescriptorImpl(
|
||||
result, null, p.getIndex() - 1, p.getAnnotations(), Name.identifier("p${p.getIndex() + 1}"), p.getType(),
|
||||
p.declaresDefaultValue(), p.getVarargElementType(), p.getSource()
|
||||
p.declaresDefaultValue(), p.isCrossinline, p.isNoinline, p.getVarargElementType(), p.getSource()
|
||||
)
|
||||
},
|
||||
original.getReturnType(),
|
||||
@@ -84,6 +84,9 @@ private fun createSynthesizedFunctionWithFirstParameterAsReceiver(descriptor: Fu
|
||||
)
|
||||
result.isOperator = original.isOperator
|
||||
result.isInfix = original.isInfix
|
||||
result.isExternal = original.isExternal
|
||||
result.isInline = original.isInline
|
||||
result.isTailrec = original.isTailrec
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
+6
-2
@@ -32,7 +32,8 @@ import org.jetbrains.kotlin.resolve.ScriptBodyResolver
|
||||
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil
|
||||
import org.jetbrains.kotlin.resolve.lazy.LazyEntity
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.jetbrains.kotlin.resolve.scopes.*
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScopeImpl
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ScriptReceiver
|
||||
import org.jetbrains.kotlin.resolve.source.toSourceElement
|
||||
import org.jetbrains.kotlin.types.DeferredType
|
||||
@@ -78,7 +79,10 @@ public class LazyScriptDescriptor(
|
||||
scriptDefinition.getScriptParameters().mapIndexed { index, scriptParameter ->
|
||||
ValueParameterDescriptorImpl(
|
||||
result, null, index, Annotations.EMPTY, scriptParameter.getName(), scriptParameter.getType(),
|
||||
false, null, SourceElement.NO_SOURCE
|
||||
/* declaresDefaultValue = */ false,
|
||||
/* isCrossinline = */ false,
|
||||
/* isNoinline = */ false,
|
||||
null, SourceElement.NO_SOURCE
|
||||
)
|
||||
},
|
||||
DeferredType.create(resolveSession.storageManager, resolveSession.trace) {
|
||||
|
||||
+5
-1
@@ -118,7 +118,11 @@ public class ControlStructureTypingUtils {
|
||||
JetType argumentType = isArgumentNullable.get(i) ? nullableType : type;
|
||||
ValueParameterDescriptorImpl valueParameter = new ValueParameterDescriptorImpl(
|
||||
function, null, i, Annotations.Companion.getEMPTY(), Name.identifier(argumentNames.get(i)),
|
||||
argumentType, false, null, SourceElement.NO_SOURCE
|
||||
argumentType,
|
||||
/* declaresDefaultValue = */ false,
|
||||
/* isCrossinline = */ false,
|
||||
/* isNoinline = */ false,
|
||||
null, SourceElement.NO_SOURCE
|
||||
);
|
||||
valueParameters.add(valueParameter);
|
||||
}
|
||||
|
||||
+2
-1
@@ -141,7 +141,8 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement
|
||||
// 1. creates full copy of descriptor
|
||||
// 2. copies method's type parameters (with new containing declaration) and properly substitute to them in value parameters, return type and etc.
|
||||
JavaMethodDescriptor enhancedMethod = (JavaMethodDescriptor) doSubstitute(
|
||||
TypeSubstitutor.EMPTY, getContainingDeclaration(), getModality(), getVisibility(), isOperator(), isInfix(), getOriginal(),
|
||||
TypeSubstitutor.EMPTY, getContainingDeclaration(), getModality(), getVisibility(),
|
||||
isOperator(), isInfix(), isExternal(), isInline(), isTailrec(), getOriginal(),
|
||||
/* copyOverrides = */ true, getKind(),
|
||||
enhancedValueParameters, enhancedReceiverType, enhancedReturnType
|
||||
);
|
||||
|
||||
+2
-2
@@ -76,7 +76,7 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
||||
if (getter != null) {
|
||||
newGetter = new PropertyGetterDescriptorImpl(
|
||||
enhanced, getter.getAnnotations(), getter.getModality(), getter.getVisibility(),
|
||||
getter.hasBody(), getter.isDefault(), getKind(), getter, SourceElement.NO_SOURCE);
|
||||
getter.hasBody(), getter.isDefault(), getter.isExternal(), getKind(), getter, SourceElement.NO_SOURCE);
|
||||
newGetter.initialize(enhancedReturnType);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
||||
if (setter != null) {
|
||||
newSetter = new PropertySetterDescriptorImpl(
|
||||
enhanced, setter.getAnnotations(), setter.getModality(), setter.getVisibility(),
|
||||
setter.hasBody(), setter.isDefault(), getKind(), setter, SourceElement.NO_SOURCE);
|
||||
setter.hasBody(), setter.isDefault(), setter.isExternal(), getKind(), setter, SourceElement.NO_SOURCE);
|
||||
newSetter.initialize(setter.getValueParameters().get(0));
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ fun copyValueParameters(
|
||||
oldParameter.getName(),
|
||||
newType,
|
||||
oldParameter.declaresDefaultValue(),
|
||||
oldParameter.isCrossinline,
|
||||
oldParameter.isNoinline,
|
||||
if (oldParameter.getVarargElementType() != null) newOwner.module.builtIns.getArrayElementType(newType) else null,
|
||||
oldParameter.getSource()
|
||||
)
|
||||
|
||||
+10
-3
@@ -41,7 +41,10 @@ import org.jetbrains.kotlin.load.java.lazy.resolveAnnotations
|
||||
import org.jetbrains.kotlin.load.java.lazy.types.RawSubstitution
|
||||
import org.jetbrains.kotlin.load.java.lazy.types.toAttributes
|
||||
import org.jetbrains.kotlin.load.java.sources.JavaSourceElement
|
||||
import org.jetbrains.kotlin.load.java.structure.*
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaArrayType
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaConstructor
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaMethod
|
||||
import org.jetbrains.kotlin.load.java.typeEnhacement.enhanceSignatures
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.DescriptorFactory
|
||||
@@ -302,13 +305,15 @@ public class LazyJavaClassMemberScope(
|
||||
propertyDescriptor.setType(getterMethod.returnType!!, listOf(), getDispatchReceiverParameter(), null as JetType?)
|
||||
|
||||
val getter = DescriptorFactory.createGetter(
|
||||
propertyDescriptor, getterMethod.annotations, /* isDefault = */false, getterMethod.source
|
||||
propertyDescriptor, getterMethod.annotations, /* isDefault = */false,
|
||||
/* isExternal = */ false, getterMethod.source
|
||||
).apply {
|
||||
initialize(propertyDescriptor.type)
|
||||
}
|
||||
|
||||
val setter = setterMethod?.let { setterMethod ->
|
||||
DescriptorFactory.createSetter(propertyDescriptor, setterMethod.annotations, /* isDefault = */false, setterMethod.visibility)
|
||||
DescriptorFactory.createSetter(propertyDescriptor, setterMethod.annotations, /* isDefault = */false,
|
||||
/* isExternal = */ false, setterMethod.visibility)
|
||||
}
|
||||
|
||||
return propertyDescriptor.apply { initialize(getter, setter) }
|
||||
@@ -517,6 +522,8 @@ public class LazyJavaClassMemberScope(
|
||||
// Parameters of annotation constructors in Java are never nullable
|
||||
TypeUtils.makeNotNullable(returnType),
|
||||
method.hasAnnotationParameterDefaultValue(),
|
||||
/* isCrossinline = */ false,
|
||||
/* isNoinline = */ false,
|
||||
// Nulls are not allowed in annotation arguments in Java
|
||||
varargElementType?.let { TypeUtils.makeNotNullable(it) },
|
||||
c.components.sourceElementFactory.source(method)
|
||||
|
||||
+3
-1
@@ -207,7 +207,9 @@ public abstract class LazyJavaScope(
|
||||
annotations,
|
||||
name,
|
||||
outType,
|
||||
false,
|
||||
/* declaresDefaultValue = */ false,
|
||||
/* isCrossinline = */ false,
|
||||
/* isNoinline = */ false,
|
||||
varargElementType,
|
||||
c.components.sourceElementFactory.source(javaParameter)
|
||||
)
|
||||
|
||||
@@ -849,7 +849,11 @@ public abstract class KotlinBuiltIns {
|
||||
TypeProjection parameterType = parameterTypes.get(i);
|
||||
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(
|
||||
functionDescriptor, null, i, Annotations.Companion.getEMPTY(),
|
||||
Name.identifier("p" + (i + 1)), parameterType.getType(), false, null, SourceElement.NO_SOURCE
|
||||
Name.identifier("p" + (i + 1)), parameterType.getType(),
|
||||
/* declaresDefaultValue = */ false,
|
||||
/* isCrossinline = */ false,
|
||||
/* isNoinline = */ false,
|
||||
null, SourceElement.NO_SOURCE
|
||||
);
|
||||
valueParameters.add(valueParameterDescriptor);
|
||||
}
|
||||
|
||||
+8
@@ -46,6 +46,12 @@ public class FunctionInvokeDescriptor private constructor(
|
||||
return FunctionInvokeDescriptor(newOwner, original as FunctionInvokeDescriptor?, kind)
|
||||
}
|
||||
|
||||
override fun isExternal(): Boolean = false
|
||||
|
||||
override fun isInline(): Boolean = false
|
||||
|
||||
override fun isTailrec(): Boolean = false
|
||||
|
||||
companion object Factory {
|
||||
fun create(functionClass: FunctionClassDescriptor): FunctionInvokeDescriptor {
|
||||
val typeParameters = functionClass.getTypeConstructor().getParameters()
|
||||
@@ -87,6 +93,8 @@ public class FunctionInvokeDescriptor private constructor(
|
||||
Name.identifier(name),
|
||||
typeParameter.getDefaultType(),
|
||||
/* declaresDefaultValue = */ false,
|
||||
/* isCrossinline = */ false,
|
||||
/* isNoinline = */ false,
|
||||
/* varargElementType = */ null,
|
||||
SourceElement.NO_SOURCE
|
||||
)
|
||||
|
||||
+63
-2
@@ -44,6 +44,9 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
private Visibility visibility = Visibilities.UNKNOWN;
|
||||
private boolean isOperator = false;
|
||||
private boolean isInfix = false;
|
||||
private boolean isExternal = false;
|
||||
private boolean isInline = false;
|
||||
private boolean isTailrec = false;
|
||||
private final Set<FunctionDescriptor> overriddenFunctions = SmartSet.create();
|
||||
private final FunctionDescriptor original;
|
||||
private final Kind kind;
|
||||
@@ -110,6 +113,18 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
this.isInfix = isInfix;
|
||||
}
|
||||
|
||||
public void setExternal(boolean isExternal) {
|
||||
this.isExternal = isExternal;
|
||||
}
|
||||
|
||||
public void setInline(boolean isInline) {
|
||||
this.isInline = isInline;
|
||||
}
|
||||
|
||||
public void setTailrec(boolean isTailrec) {
|
||||
this.isTailrec = isTailrec;
|
||||
}
|
||||
|
||||
public void setReturnType(@NotNull JetType unsubstitutedReturnType) {
|
||||
if (this.unsubstitutedReturnType != null) {
|
||||
// TODO: uncomment and fix tests
|
||||
@@ -170,6 +185,39 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExternal() {
|
||||
if (isExternal) return true;
|
||||
|
||||
for (FunctionDescriptor descriptor : overriddenFunctions) {
|
||||
if (descriptor.isExternal()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInline() {
|
||||
if (isInline) return true;
|
||||
|
||||
for (FunctionDescriptor descriptor : overriddenFunctions) {
|
||||
if (descriptor.isInline()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTailrec() {
|
||||
if (isTailrec) return true;
|
||||
|
||||
for (FunctionDescriptor descriptor : overriddenFunctions) {
|
||||
if (descriptor.isTailrec()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOverriddenDescriptor(@NotNull CallableMemberDescriptor overriddenFunction) {
|
||||
overriddenFunctions.add((FunctionDescriptor) overriddenFunction);
|
||||
@@ -219,7 +267,9 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
if (originalSubstitutor.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
return doSubstitute(originalSubstitutor, getContainingDeclaration(), modality, visibility, isOperator, isInfix, getOriginal(), true, getKind());
|
||||
return doSubstitute(originalSubstitutor, getContainingDeclaration(), modality, visibility,
|
||||
isOperator, isInfix, isExternal, isInline, isTailrec,
|
||||
getOriginal(), true, getKind());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -229,12 +279,15 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
@NotNull Visibility newVisibility,
|
||||
boolean isOperator,
|
||||
boolean isInfix,
|
||||
boolean isExternal,
|
||||
boolean isInline,
|
||||
boolean isTailrec,
|
||||
@Nullable FunctionDescriptor original,
|
||||
boolean copyOverrides,
|
||||
@NotNull Kind kind
|
||||
) {
|
||||
return doSubstitute(originalSubstitutor,
|
||||
newOwner, newModality, newVisibility, isOperator, isInfix, original, copyOverrides, kind,
|
||||
newOwner, newModality, newVisibility, isOperator, isInfix, isExternal, isInline, isTailrec, original, copyOverrides, kind,
|
||||
getValueParameters(), getExtensionReceiverParameterType(), getReturnType()
|
||||
);
|
||||
}
|
||||
@@ -253,6 +306,9 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
@NotNull Visibility newVisibility,
|
||||
boolean isOperator,
|
||||
boolean isInfix,
|
||||
boolean isExternal,
|
||||
boolean isInline,
|
||||
boolean isTailrec,
|
||||
@Nullable FunctionDescriptor original,
|
||||
boolean copyOverrides,
|
||||
@NotNull Kind kind,
|
||||
@@ -317,6 +373,9 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
);
|
||||
substitutedDescriptor.setOperator(isOperator);
|
||||
substitutedDescriptor.setInfix(isInfix);
|
||||
substitutedDescriptor.setExternal(isExternal);
|
||||
substitutedDescriptor.setInline(isInline);
|
||||
substitutedDescriptor.setTailrec(isTailrec);
|
||||
|
||||
if (copyOverrides) {
|
||||
for (FunctionDescriptor overriddenFunction : overriddenFunctions) {
|
||||
@@ -362,6 +421,8 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
unsubstitutedValueParameter.getName(),
|
||||
substitutedType,
|
||||
unsubstitutedValueParameter.declaresDefaultValue(),
|
||||
unsubstitutedValueParameter.isCrossinline(),
|
||||
unsubstitutedValueParameter.isNoinline(),
|
||||
substituteVarargElementType,
|
||||
SourceElement.NO_SOURCE
|
||||
)
|
||||
|
||||
+18
@@ -32,6 +32,7 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
||||
|
||||
private final boolean hasBody;
|
||||
private final boolean isDefault;
|
||||
private final boolean isExternal;
|
||||
private final Modality modality;
|
||||
private final PropertyDescriptor correspondingProperty;
|
||||
private final Kind kind;
|
||||
@@ -45,6 +46,7 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
||||
@NotNull Name name,
|
||||
boolean hasBody,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
Kind kind,
|
||||
@NotNull SourceElement source
|
||||
) {
|
||||
@@ -54,6 +56,7 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
||||
this.correspondingProperty = correspondingProperty;
|
||||
this.hasBody = hasBody;
|
||||
this.isDefault = isDefault;
|
||||
this.isExternal = isExternal;
|
||||
this.kind = kind;
|
||||
}
|
||||
|
||||
@@ -83,6 +86,21 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExternal() {
|
||||
return isExternal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInline() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTailrec() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FunctionDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
|
||||
+2
-2
@@ -257,7 +257,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
|
||||
PropertyGetterDescriptorImpl newGetter = getter == null ? null : new PropertyGetterDescriptorImpl(
|
||||
substitutedDescriptor, getter.getAnnotations(), newModality, convertVisibility(getter.getVisibility(), newVisibility),
|
||||
getter.hasBody(), getter.isDefault(), kind, original == null ? null : original.getGetter(), SourceElement.NO_SOURCE
|
||||
getter.hasBody(), getter.isDefault(), getter.isExternal(), kind, original == null ? null : original.getGetter(), SourceElement.NO_SOURCE
|
||||
);
|
||||
if (newGetter != null) {
|
||||
JetType returnType = getter.getReturnType();
|
||||
@@ -265,7 +265,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
}
|
||||
PropertySetterDescriptorImpl newSetter = setter == null ? null : new PropertySetterDescriptorImpl(
|
||||
substitutedDescriptor, setter.getAnnotations(), newModality, convertVisibility(setter.getVisibility(), newVisibility),
|
||||
setter.hasBody(), setter.isDefault(), kind, original == null ? null : original.getSetter(), SourceElement.NO_SOURCE
|
||||
setter.hasBody(), setter.isDefault(), setter.isExternal(), kind, original == null ? null : original.getSetter(), SourceElement.NO_SOURCE
|
||||
);
|
||||
if (newSetter != null) {
|
||||
List<ValueParameterDescriptor> substitutedValueParameters = FunctionDescriptorImpl.getSubstitutedValueParameters(
|
||||
|
||||
+2
-1
@@ -40,13 +40,14 @@ public class PropertyGetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
||||
@NotNull Visibility visibility,
|
||||
boolean hasBody,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
@NotNull Kind kind,
|
||||
@Nullable PropertyGetterDescriptor original,
|
||||
@NotNull SourceElement source
|
||||
)
|
||||
{
|
||||
super(modality, visibility, correspondingProperty, annotations, Name.special("<get-" + correspondingProperty.getName() + ">"),
|
||||
hasBody, isDefault, kind, source);
|
||||
hasBody, isDefault, isExternal, kind, source);
|
||||
this.original = original != null ? original : this;
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -42,12 +42,13 @@ public class PropertySetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
||||
@NotNull Visibility visibility,
|
||||
boolean hasBody,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
@NotNull Kind kind,
|
||||
@Nullable PropertySetterDescriptor original,
|
||||
@NotNull SourceElement source
|
||||
) {
|
||||
super(modality, visibility, correspondingProperty, annotations, Name.special("<set-" + correspondingProperty.getName() + ">"),
|
||||
hasBody, isDefault, kind, source);
|
||||
hasBody, isDefault, isExternal, kind, source);
|
||||
this.original = original != null ? original : this;
|
||||
}
|
||||
|
||||
@@ -66,7 +67,11 @@ public class PropertySetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
||||
@NotNull JetType type
|
||||
) {
|
||||
return new ValueParameterDescriptorImpl(
|
||||
setterDescriptor, null, 0, Annotations.Companion.getEMPTY(), Name.special("<set-?>"), type, false, null, SourceElement.NO_SOURCE
|
||||
setterDescriptor, null, 0, Annotations.Companion.getEMPTY(), Name.special("<set-?>"), type,
|
||||
/* declaresDefaultValue = */ false,
|
||||
/* isCrossinline = */ false,
|
||||
/* isNoinline = */ false,
|
||||
null, SourceElement.NO_SOURCE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,4 +55,19 @@ public class ScriptCodeDescriptor extends FunctionDescriptorImpl {
|
||||
public FunctionDescriptor copy(DeclarationDescriptor newOwner, Modality modality, Visibility visibility, Kind kind, boolean copyOverrides) {
|
||||
throw new IllegalStateException("no need to copy script code descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExternal() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInline() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTailrec() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -99,7 +99,9 @@ public class SimpleFunctionDescriptorImpl extends FunctionDescriptorImpl impleme
|
||||
boolean copyOverrides
|
||||
) {
|
||||
return (SimpleFunctionDescriptorImpl) doSubstitute(
|
||||
TypeSubstitutor.EMPTY, newOwner, modality, visibility, isOperator(), isInfix(), null, copyOverrides, kind
|
||||
TypeSubstitutor.EMPTY, newOwner, modality, visibility,
|
||||
isOperator(), isInfix(), isExternal(), isInline(), isTailrec(),
|
||||
null, copyOverrides, kind
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+22
-2
@@ -31,6 +31,8 @@ import java.util.Collection;
|
||||
|
||||
public class ValueParameterDescriptorImpl extends VariableDescriptorImpl implements ValueParameterDescriptor {
|
||||
private final boolean declaresDefaultValue;
|
||||
private final boolean isCrossinline;
|
||||
private final boolean isNoinline;
|
||||
private final JetType varargElementType;
|
||||
private final int index;
|
||||
private final ValueParameterDescriptor original;
|
||||
@@ -43,6 +45,8 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
||||
@NotNull Name name,
|
||||
@NotNull JetType outType,
|
||||
boolean declaresDefaultValue,
|
||||
boolean isCrossinline,
|
||||
boolean isNoinline,
|
||||
@Nullable JetType varargElementType,
|
||||
@NotNull SourceElement source
|
||||
) {
|
||||
@@ -50,6 +54,8 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
||||
this.original = original == null ? this : original;
|
||||
this.index = index;
|
||||
this.declaresDefaultValue = declaresDefaultValue;
|
||||
this.isCrossinline = isCrossinline;
|
||||
this.isNoinline = isNoinline;
|
||||
this.varargElementType = varargElementType;
|
||||
}
|
||||
|
||||
@@ -66,7 +72,17 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
||||
|
||||
@Override
|
||||
public boolean declaresDefaultValue() {
|
||||
return declaresDefaultValue && ((CallableMemberDescriptor) getContainingDeclaration()).getKind().isReal();
|
||||
return declaresDefaultValue && containingDeclarationIsReal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCrossinline() {
|
||||
return isCrossinline && containingDeclarationIsReal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNoinline() {
|
||||
return isNoinline && containingDeclarationIsReal();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -108,7 +124,7 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
||||
@Override
|
||||
public ValueParameterDescriptor copy(@NotNull CallableDescriptor newOwner, @NotNull Name newName) {
|
||||
return new ValueParameterDescriptorImpl(
|
||||
newOwner, null, index, getAnnotations(), newName, getType(), declaresDefaultValue(), varargElementType,
|
||||
newOwner, null, index, getAnnotations(), newName, getType(), declaresDefaultValue(), isCrossinline(), isNoinline(), varargElementType,
|
||||
SourceElement.NO_SOURCE
|
||||
);
|
||||
}
|
||||
@@ -131,4 +147,8 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean containingDeclarationIsReal() {
|
||||
return ((CallableMemberDescriptor) getContainingDeclaration()).getKind().isReal();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,16 +50,7 @@ public class DescriptorFactory {
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations
|
||||
) {
|
||||
return createSetter(propertyDescriptor, annotations, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PropertySetterDescriptorImpl createSetter(
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault
|
||||
) {
|
||||
return createSetter(propertyDescriptor, annotations, isDefault, propertyDescriptor.getVisibility());
|
||||
return createSetter(propertyDescriptor, annotations, true, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -67,11 +58,22 @@ public class DescriptorFactory {
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal
|
||||
) {
|
||||
return createSetter(propertyDescriptor, annotations, isDefault, isExternal, propertyDescriptor.getVisibility());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PropertySetterDescriptorImpl createSetter(
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
@NotNull Visibility visibility
|
||||
) {
|
||||
PropertySetterDescriptorImpl setterDescriptor =
|
||||
new PropertySetterDescriptorImpl(propertyDescriptor, annotations, propertyDescriptor.getModality(),
|
||||
visibility, !isDefault, isDefault,
|
||||
visibility, !isDefault, isDefault, isExternal,
|
||||
CallableMemberDescriptor.Kind.DECLARATION, null, propertyDescriptor.getSource());
|
||||
setterDescriptor.initializeDefault();
|
||||
return setterDescriptor;
|
||||
@@ -82,15 +84,7 @@ public class DescriptorFactory {
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations
|
||||
) {
|
||||
return createGetter(propertyDescriptor, annotations, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PropertyGetterDescriptorImpl createGetter(
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault) {
|
||||
return createGetter(propertyDescriptor, annotations, isDefault, propertyDescriptor.getSource());
|
||||
return createGetter(propertyDescriptor, annotations, true, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -98,9 +92,20 @@ public class DescriptorFactory {
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal
|
||||
) {
|
||||
return createGetter(propertyDescriptor, annotations, isDefault, isExternal, propertyDescriptor.getSource());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PropertyGetterDescriptorImpl createGetter(
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
@NotNull SourceElement sourceElement) {
|
||||
return new PropertyGetterDescriptorImpl(propertyDescriptor, annotations, propertyDescriptor.getModality(),
|
||||
propertyDescriptor.getVisibility(), !isDefault, isDefault,
|
||||
propertyDescriptor.getVisibility(), !isDefault, isDefault, isExternal,
|
||||
CallableMemberDescriptor.Kind.DECLARATION, null, sourceElement);
|
||||
}
|
||||
|
||||
@@ -153,7 +158,11 @@ public class DescriptorFactory {
|
||||
SimpleFunctionDescriptorImpl.create(enumClass, Annotations.Companion.getEMPTY(), DescriptorUtils.ENUM_VALUE_OF,
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED, enumClass.getSource());
|
||||
ValueParameterDescriptor parameterDescriptor = new ValueParameterDescriptorImpl(
|
||||
valueOf, null, 0, Annotations.Companion.getEMPTY(), Name.identifier("value"), getBuiltIns(enumClass).getStringType(), false, null,
|
||||
valueOf, null, 0, Annotations.Companion.getEMPTY(), Name.identifier("value"), getBuiltIns(enumClass).getStringType(),
|
||||
/* declaresDefaultValue = */ false,
|
||||
/* isCrossinline = */ false,
|
||||
/* isNoinline = */ false,
|
||||
null,
|
||||
enumClass.getSource()
|
||||
);
|
||||
return valueOf.initialize(null, null, Collections.<TypeParameterDescriptor>emptyList(),
|
||||
|
||||
+9
@@ -67,6 +67,7 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
||||
val getter = if (hasGetter) {
|
||||
val getterFlags = proto.getGetterFlags()
|
||||
val isNotDefault = proto.hasGetterFlags() && Flags.IS_NOT_DEFAULT.get(getterFlags)
|
||||
val isExternal = proto.hasGetterFlags() && Flags.IS_EXTERNAL_ACCESSOR.get(getterFlags)
|
||||
val getter = if (isNotDefault) {
|
||||
PropertyGetterDescriptorImpl(
|
||||
property,
|
||||
@@ -75,6 +76,7 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
||||
Deserialization.visibility(Flags.VISIBILITY.get(getterFlags)),
|
||||
/* hasBody = */ isNotDefault,
|
||||
/* isDefault = */ !isNotDefault,
|
||||
/* isExternal = */ isExternal,
|
||||
property.getKind(), null, SourceElement.NO_SOURCE
|
||||
)
|
||||
}
|
||||
@@ -91,6 +93,7 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
||||
val setter = if (Flags.HAS_SETTER.get(flags)) {
|
||||
val setterFlags = proto.getSetterFlags()
|
||||
val isNotDefault = proto.hasSetterFlags() && Flags.IS_NOT_DEFAULT.get(setterFlags)
|
||||
val isExternal = proto.hasSetterFlags() && Flags.IS_EXTERNAL_ACCESSOR.get(setterFlags)
|
||||
if (isNotDefault) {
|
||||
val setter = PropertySetterDescriptorImpl(
|
||||
property,
|
||||
@@ -99,6 +102,7 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
||||
Deserialization.visibility(Flags.VISIBILITY.get(setterFlags)),
|
||||
/* hasBody = */ isNotDefault,
|
||||
/* isDefault = */ !isNotDefault,
|
||||
/* isExternal = */ isExternal,
|
||||
property.getKind(), null, SourceElement.NO_SOURCE
|
||||
)
|
||||
val setterLocal = local.childContext(setter, listOf())
|
||||
@@ -148,6 +152,9 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
||||
)
|
||||
function.isOperator = Flags.IS_OPERATOR.get(proto.flags)
|
||||
function.isInfix = Flags.IS_INFIX.get(proto.flags)
|
||||
function.isExternal = Flags.IS_EXTERNAL_FUNCTION.get(proto.flags)
|
||||
function.isInline = Flags.IS_INLINE.get(proto.flags)
|
||||
function.isTailrec = Flags.IS_TAILREC.get(proto.flags)
|
||||
return function
|
||||
}
|
||||
|
||||
@@ -212,6 +219,8 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
||||
c.nameResolver.getName(proto.name),
|
||||
c.typeDeserializer.type(proto.type(c.typeTable)),
|
||||
Flags.DECLARES_DEFAULT_VALUE.get(flags),
|
||||
Flags.IS_CROSSINLINE.get(flags),
|
||||
Flags.IS_NOINLINE.get(flags),
|
||||
proto.varargElementType(c.typeTable)?.let { c.typeDeserializer.type(it) },
|
||||
SourceElement.NO_SOURCE
|
||||
)
|
||||
|
||||
+6
@@ -45,4 +45,10 @@ public class DeserializedConstructorDescriptor(
|
||||
annotations, isPrimary, kind, proto, nameResolver, typeTable
|
||||
)
|
||||
}
|
||||
|
||||
override fun isExternal(): Boolean = false
|
||||
|
||||
override fun isInline(): Boolean = false
|
||||
|
||||
override fun isTailrec(): Boolean = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user