Metadata: 'non-stable parameter names' flag for callables
^KT-34602
This commit is contained in:
+5
@@ -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
|
||||
|
||||
+5
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ class JvmMetadataVersion(versionArray: IntArray, val isStrictSemantics: Boolean)
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val INSTANCE = JvmMetadataVersion(1, 4, 0)
|
||||
val INSTANCE = JvmMetadataVersion(1, 4, 1)
|
||||
|
||||
@JvmField
|
||||
val INVALID_VERSION = JvmMetadataVersion()
|
||||
|
||||
@@ -270,6 +270,7 @@ message Constructor {
|
||||
hasAnnotations
|
||||
Visibility
|
||||
isSecondary
|
||||
hasNonStableParameterNames
|
||||
*/
|
||||
optional int32 flags = 1 [default = 6 /* public constructor, no annotations */];
|
||||
|
||||
@@ -294,6 +295,7 @@ message Function {
|
||||
isExternal
|
||||
isSuspend
|
||||
isExpect
|
||||
hasNonStableParameterNames
|
||||
*/
|
||||
optional int32 flags = 9 [default = 6 /* public final function, no annotations */];
|
||||
optional int32 old_flags = 1 [default = 6];
|
||||
|
||||
@@ -35,6 +35,7 @@ public class Flags {
|
||||
// Constructors
|
||||
|
||||
public static final BooleanFlagField IS_SECONDARY = FlagField.booleanAfter(VISIBILITY);
|
||||
public static final BooleanFlagField IS_CONSTRUCTOR_WITH_NON_STABLE_PARAMETER_NAMES = FlagField.booleanAfter(IS_SECONDARY);
|
||||
|
||||
// Callables
|
||||
|
||||
@@ -49,6 +50,7 @@ public class Flags {
|
||||
public static final BooleanFlagField IS_EXTERNAL_FUNCTION = FlagField.booleanAfter(IS_TAILREC);
|
||||
public static final BooleanFlagField IS_SUSPEND = FlagField.booleanAfter(IS_EXTERNAL_FUNCTION);
|
||||
public static final BooleanFlagField IS_EXPECT_FUNCTION = FlagField.booleanAfter(IS_SUSPEND);
|
||||
public static final BooleanFlagField IS_FUNCTION_WITH_NON_STABLE_PARAMETER_NAMES = FlagField.booleanAfter(IS_EXPECT_FUNCTION);
|
||||
|
||||
// Properties
|
||||
|
||||
@@ -115,11 +117,13 @@ public class Flags {
|
||||
public static int getConstructorFlags(
|
||||
boolean hasAnnotations,
|
||||
@NotNull ProtoBuf.Visibility visibility,
|
||||
boolean isSecondary
|
||||
boolean isSecondary,
|
||||
boolean hasStableParameterNames
|
||||
) {
|
||||
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
||||
| VISIBILITY.toFlags(visibility)
|
||||
| IS_SECONDARY.toFlags(isSecondary)
|
||||
| IS_CONSTRUCTOR_WITH_NON_STABLE_PARAMETER_NAMES.toFlags(!hasStableParameterNames)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -134,7 +138,8 @@ public class Flags {
|
||||
boolean isTailrec,
|
||||
boolean isExternal,
|
||||
boolean isSuspend,
|
||||
boolean isExpect
|
||||
boolean isExpect,
|
||||
boolean hasStableParameterNames
|
||||
) {
|
||||
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
||||
| VISIBILITY.toFlags(visibility)
|
||||
@@ -147,6 +152,7 @@ public class Flags {
|
||||
| IS_EXTERNAL_FUNCTION.toFlags(isExternal)
|
||||
| IS_SUSPEND.toFlags(isSuspend)
|
||||
| IS_EXPECT_FUNCTION.toFlags(isExpect)
|
||||
| IS_FUNCTION_WITH_NON_STABLE_PARAMETER_NAMES.toFlags(!hasStableParameterNames)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user