Metadata: 'non-stable parameter names' flag for callables

^KT-34602
This commit is contained in:
Dmitriy Dolovov
2020-07-20 18:21:34 +07:00
parent 8cace2bab4
commit 3d9093583f
16 changed files with 334 additions and 15 deletions
@@ -272,6 +272,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
ProtoEnumFlags.memberKind(Flags.MEMBER_KIND.get(flags)), proto, c.nameResolver, c.typeTable, versionRequirementTable,
c.containerSource
)
val local = c.childContext(function, proto.typeParameterList)
function.initializeWithCoroutinesExperimentalityStatus(
@@ -294,6 +295,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
function.isTailrec = Flags.IS_TAILREC.get(flags)
function.isSuspend = Flags.IS_SUSPEND.get(flags)
function.isExpect = Flags.IS_EXPECT_FUNCTION.get(flags)
function.setHasStableParameterNames(!Flags.IS_FUNCTION_WITH_NON_STABLE_PARAMETER_NAMES.get(flags))
val mapValueForContract =
c.components.contractDeserializer.deserializeContractFromFunction(proto, function, c.typeTable, local.typeDeserializer)
@@ -337,6 +339,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
isPrimary, CallableMemberDescriptor.Kind.DECLARATION, proto, c.nameResolver, c.typeTable, c.versionRequirementTable,
c.containerSource
)
val local = c.childContext(descriptor, listOf())
descriptor.initialize(
local.memberDeserializer.valueParameters(proto.valueParameterList, proto, AnnotatedCallableKind.FUNCTION),
@@ -344,6 +347,8 @@ class MemberDeserializer(private val c: DeserializationContext) {
)
descriptor.returnType = classDescriptor.defaultType
descriptor.setHasStableParameterNames(!Flags.IS_CONSTRUCTOR_WITH_NON_STABLE_PARAMETER_NAMES.get(proto.flags))
val doesClassContainIncompatibility =
(c.containingDeclaration as? DeserializedClassDescriptor)
?.c?.typeDeserializer?.experimentalSuspendFunctionTypeEncountered == true
@@ -120,6 +120,7 @@ class DeserializedSimpleFunctionDescriptor(
newOwner, original as SimpleFunctionDescriptor?, annotations, newName ?: name, kind,
proto, nameResolver, typeTable, versionRequirementTable, containerSource, source
).also {
it.setHasStableParameterNames(hasStableParameterNames())
it.coroutinesExperimentalCompatibilityMode = coroutinesExperimentalCompatibilityMode
}
}
@@ -209,7 +210,10 @@ class DeserializedClassConstructorDescriptor(
return DeserializedClassConstructorDescriptor(
newOwner as ClassDescriptor, original as ConstructorDescriptor?, annotations, isPrimary, kind,
proto, nameResolver, typeTable, versionRequirementTable, containerSource, source
).also { it.coroutinesExperimentalCompatibilityMode = coroutinesExperimentalCompatibilityMode }
).also {
it.setHasStableParameterNames(hasStableParameterNames())
it.coroutinesExperimentalCompatibilityMode = coroutinesExperimentalCompatibilityMode
}
}
override fun isExternal(): Boolean = false