Rename SinceKotlinInfo -> VersionRequirement
This commit is contained in:
@@ -211,10 +211,10 @@ message Class {
|
||||
|
||||
optional TypeTable type_table = 30;
|
||||
|
||||
// Index into the SinceKotlinInfoTable
|
||||
optional int32 sinceKotlinInfo = 31;
|
||||
// Index into the VersionRequirementTable
|
||||
optional int32 version_requirement = 31;
|
||||
|
||||
optional SinceKotlinInfoTable since_kotlin_info_table = 32;
|
||||
optional VersionRequirementTable version_requirement_table = 32;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ message Package {
|
||||
|
||||
optional TypeTable type_table = 30;
|
||||
|
||||
optional SinceKotlinInfoTable since_kotlin_info_table = 32;
|
||||
optional VersionRequirementTable version_requirement_table = 32;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -249,8 +249,8 @@ message Constructor {
|
||||
|
||||
repeated ValueParameter value_parameter = 2;
|
||||
|
||||
// Index into the SinceKotlinInfoTable
|
||||
optional int32 sinceKotlinInfo = 31;
|
||||
// Index into the VersionRequirementTable
|
||||
optional int32 version_requirement = 31;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -286,8 +286,8 @@ message Function {
|
||||
|
||||
optional TypeTable type_table = 30;
|
||||
|
||||
// Index into the SinceKotlinInfoTable
|
||||
optional int32 sinceKotlinInfo = 31;
|
||||
// Index into the VersionRequirementTable
|
||||
optional int32 version_requirement = 31;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -334,8 +334,8 @@ message Property {
|
||||
optional int32 getter_flags = 7 /* absent => same as property */;
|
||||
optional int32 setter_flags = 8 /* absent => same as property */;
|
||||
|
||||
// Index into the SinceKotlinInfoTable
|
||||
optional int32 sinceKotlinInfo = 31;
|
||||
// Index into the VersionRequirementTable
|
||||
optional int32 version_requirement = 31;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -379,8 +379,8 @@ message TypeAlias {
|
||||
|
||||
repeated Annotation annotation = 8;
|
||||
|
||||
// Index into the SinceKotlinInfoTable
|
||||
optional int32 sinceKotlinInfo = 31;
|
||||
// Index into the VersionRequirementTable
|
||||
optional int32 version_requirement = 31;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -417,7 +417,7 @@ enum MemberKind {
|
||||
SYNTHESIZED = 3;
|
||||
}
|
||||
|
||||
message SinceKotlinInfo {
|
||||
message VersionRequirement {
|
||||
enum Level {
|
||||
WARNING = 0;
|
||||
ERROR = 1;
|
||||
@@ -443,8 +443,8 @@ message SinceKotlinInfo {
|
||||
optional int32 message = 5 [(string_id_in_table) = true];
|
||||
}
|
||||
|
||||
message SinceKotlinInfoTable {
|
||||
repeated SinceKotlinInfo info = 1;
|
||||
message VersionRequirementTable {
|
||||
repeated VersionRequirement requirement = 1;
|
||||
}
|
||||
|
||||
// A part of the package, which is used to serialize .kjsm/.meta.js, .kotlin_builtins and .kotlin_metadata files.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.serialization.ClassDataWithSource
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.SinceKotlinInfoTable
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirementTable
|
||||
|
||||
class ClassDeserializer(private val components: DeserializationComponents) {
|
||||
private val classes: (ClassKey) -> ClassDescriptor? =
|
||||
@@ -61,7 +61,7 @@ class ClassDeserializer(private val components: DeserializationComponents) {
|
||||
components.createContext(
|
||||
fragment, nameResolver,
|
||||
TypeTable(classProto.typeTable),
|
||||
SinceKotlinInfoTable.create(classProto.sinceKotlinInfoTable),
|
||||
VersionRequirementTable.create(classProto.versionRequirementTable),
|
||||
containerSource = null
|
||||
)
|
||||
}
|
||||
|
||||
+4
-4
@@ -51,7 +51,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
proto,
|
||||
c.nameResolver,
|
||||
c.typeTable,
|
||||
c.sinceKotlinInfoTable,
|
||||
c.versionRequirementTable,
|
||||
c.containerSource
|
||||
)
|
||||
|
||||
@@ -158,7 +158,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
else Annotations.EMPTY
|
||||
val function = DeserializedSimpleFunctionDescriptor(
|
||||
c.containingDeclaration, /* original = */ null, annotations, c.nameResolver.getName(proto.name),
|
||||
Deserialization.memberKind(Flags.MEMBER_KIND.get(flags)), proto, c.nameResolver, c.typeTable, c.sinceKotlinInfoTable,
|
||||
Deserialization.memberKind(Flags.MEMBER_KIND.get(flags)), proto, c.nameResolver, c.typeTable, c.versionRequirementTable,
|
||||
c.containerSource
|
||||
)
|
||||
val local = c.childContext(function, proto.typeParameterList)
|
||||
@@ -187,7 +187,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
val visibility = Deserialization.visibility(Flags.VISIBILITY.get(proto.flags))
|
||||
val typeAlias = DeserializedTypeAliasDescriptor(
|
||||
c.storageManager, c.containingDeclaration, annotations, c.nameResolver.getName(proto.name),
|
||||
visibility, proto, c.nameResolver, c.typeTable, c.sinceKotlinInfoTable, c.containerSource
|
||||
visibility, proto, c.nameResolver, c.typeTable, c.versionRequirementTable, c.containerSource
|
||||
)
|
||||
|
||||
val local = c.childContext(typeAlias, proto.typeParameterList)
|
||||
@@ -208,7 +208,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
val classDescriptor = c.containingDeclaration as ClassDescriptor
|
||||
val descriptor = DeserializedClassConstructorDescriptor(
|
||||
classDescriptor, null, getAnnotations(proto, proto.flags, AnnotatedCallableKind.FUNCTION),
|
||||
isPrimary, CallableMemberDescriptor.Kind.DECLARATION, proto, c.nameResolver, c.typeTable, c.sinceKotlinInfoTable,
|
||||
isPrimary, CallableMemberDescriptor.Kind.DECLARATION, proto, c.nameResolver, c.typeTable, c.versionRequirementTable,
|
||||
c.containerSource
|
||||
)
|
||||
val local = c.childContext(descriptor, listOf())
|
||||
|
||||
+5
-5
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.SinceKotlinInfoTable
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirementTable
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
class DeserializationComponents(
|
||||
@@ -54,10 +54,10 @@ class DeserializationComponents(
|
||||
descriptor: PackageFragmentDescriptor,
|
||||
nameResolver: NameResolver,
|
||||
typeTable: TypeTable,
|
||||
sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
versionRequirementTable: VersionRequirementTable,
|
||||
containerSource: DeserializedContainerSource?
|
||||
): DeserializationContext =
|
||||
DeserializationContext(this, nameResolver, descriptor, typeTable, sinceKotlinInfoTable, containerSource,
|
||||
DeserializationContext(this, nameResolver, descriptor, typeTable, versionRequirementTable, containerSource,
|
||||
parentTypeDeserializer = null, typeParameters = listOf())
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class DeserializationContext(
|
||||
val nameResolver: NameResolver,
|
||||
val containingDeclaration: DeclarationDescriptor,
|
||||
val typeTable: TypeTable,
|
||||
val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
val versionRequirementTable: VersionRequirementTable,
|
||||
val containerSource: DeserializedContainerSource?,
|
||||
parentTypeDeserializer: TypeDeserializer?,
|
||||
typeParameters: List<ProtoBuf.TypeParameter>
|
||||
@@ -85,7 +85,7 @@ class DeserializationContext(
|
||||
nameResolver: NameResolver = this.nameResolver,
|
||||
typeTable: TypeTable = this.typeTable
|
||||
) = DeserializationContext(
|
||||
components, nameResolver, descriptor, typeTable, sinceKotlinInfoTable, this.containerSource,
|
||||
components, nameResolver, descriptor, typeTable, versionRequirementTable, this.containerSource,
|
||||
parentTypeDeserializer = this.typeDeserializer, typeParameters = typeParameterProtos
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -73,8 +73,8 @@ class DeserializedClassDescriptor(
|
||||
(containingDeclaration as? DeserializedClassDescriptor)?.thisAsProtoContainer
|
||||
)
|
||||
|
||||
val sinceKotlinInfo: SinceKotlinInfo?
|
||||
get() = SinceKotlinInfo.create(classProto, c.nameResolver, c.sinceKotlinInfoTable)
|
||||
val versionRequirement: VersionRequirement?
|
||||
get() = VersionRequirement.create(classProto, c.nameResolver, c.versionRequirementTable)
|
||||
|
||||
override val annotations =
|
||||
if (!Flags.HAS_ANNOTATIONS.get(classProto.flags)) {
|
||||
|
||||
+11
-11
@@ -36,10 +36,10 @@ interface DeserializedMemberDescriptor : MemberDescriptor {
|
||||
|
||||
val typeTable: TypeTable
|
||||
|
||||
val sinceKotlinInfoTable: SinceKotlinInfoTable
|
||||
val versionRequirementTable: VersionRequirementTable
|
||||
|
||||
val sinceKotlinInfo: SinceKotlinInfo?
|
||||
get() = SinceKotlinInfo.create(proto, nameResolver, sinceKotlinInfoTable)
|
||||
val versionRequirement: VersionRequirement?
|
||||
get() = VersionRequirement.create(proto, nameResolver, versionRequirementTable)
|
||||
|
||||
// Information about the origin of this callable's container (class or package part on JVM) or null if there's no such information.
|
||||
// TODO: merge with sourceElement of containingDeclaration
|
||||
@@ -68,7 +68,7 @@ class DeserializedSimpleFunctionDescriptor(
|
||||
override val proto: ProtoBuf.Function,
|
||||
override val nameResolver: NameResolver,
|
||||
override val typeTable: TypeTable,
|
||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
override val versionRequirementTable: VersionRequirementTable,
|
||||
override val containerSource: DeserializedContainerSource?,
|
||||
source: SourceElement? = null
|
||||
) : DeserializedCallableMemberDescriptor,
|
||||
@@ -86,7 +86,7 @@ class DeserializedSimpleFunctionDescriptor(
|
||||
): FunctionDescriptorImpl {
|
||||
return DeserializedSimpleFunctionDescriptor(
|
||||
newOwner, original as SimpleFunctionDescriptor?, annotations, newName ?: name, kind,
|
||||
proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource, source
|
||||
proto, nameResolver, typeTable, versionRequirementTable, containerSource, source
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ class DeserializedPropertyDescriptor(
|
||||
override val proto: ProtoBuf.Property,
|
||||
override val nameResolver: NameResolver,
|
||||
override val typeTable: TypeTable,
|
||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
override val versionRequirementTable: VersionRequirementTable,
|
||||
override val containerSource: DeserializedContainerSource?
|
||||
) : DeserializedCallableMemberDescriptor, PropertyDescriptorImpl(
|
||||
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE,
|
||||
@@ -124,7 +124,7 @@ class DeserializedPropertyDescriptor(
|
||||
): PropertyDescriptorImpl {
|
||||
return DeserializedPropertyDescriptor(
|
||||
newOwner, original, annotations, newModality, newVisibility, isVar, newName, kind, isLateInit, isConst, isExternal,
|
||||
@Suppress("DEPRECATION") isDelegated, isExpect, proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource
|
||||
@Suppress("DEPRECATION") isDelegated, isExpect, proto, nameResolver, typeTable, versionRequirementTable, containerSource
|
||||
)
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ class DeserializedClassConstructorDescriptor(
|
||||
override val proto: ProtoBuf.Constructor,
|
||||
override val nameResolver: NameResolver,
|
||||
override val typeTable: TypeTable,
|
||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
override val versionRequirementTable: VersionRequirementTable,
|
||||
override val containerSource: DeserializedContainerSource?,
|
||||
source: SourceElement? = null
|
||||
) : DeserializedCallableMemberDescriptor,
|
||||
@@ -156,7 +156,7 @@ class DeserializedClassConstructorDescriptor(
|
||||
): DeserializedClassConstructorDescriptor {
|
||||
return DeserializedClassConstructorDescriptor(
|
||||
newOwner as ClassDescriptor, original as ConstructorDescriptor?, annotations, isPrimary, kind,
|
||||
proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource, source
|
||||
proto, nameResolver, typeTable, versionRequirementTable, containerSource, source
|
||||
)
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ class DeserializedTypeAliasDescriptor(
|
||||
override val proto: ProtoBuf.TypeAlias,
|
||||
override val nameResolver: NameResolver,
|
||||
override val typeTable: TypeTable,
|
||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
override val versionRequirementTable: VersionRequirementTable,
|
||||
override val containerSource: DeserializedContainerSource?
|
||||
) : AbstractTypeAliasDescriptor(containingDeclaration, annotations, name, SourceElement.NO_SOURCE, visibility),
|
||||
DeserializedMemberDescriptor {
|
||||
@@ -219,7 +219,7 @@ class DeserializedTypeAliasDescriptor(
|
||||
proto,
|
||||
nameResolver,
|
||||
typeTable,
|
||||
sinceKotlinInfoTable,
|
||||
versionRequirementTable,
|
||||
containerSource
|
||||
)
|
||||
substituted.initialize(declaredTypeParameters,
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ open class DeserializedPackageMemberScope(
|
||||
classNames: () -> Collection<Name>
|
||||
) : DeserializedMemberScope(
|
||||
components.createContext(packageDescriptor, nameResolver, TypeTable(proto.typeTable),
|
||||
SinceKotlinInfoTable.create(proto.sinceKotlinInfoTable), containerSource),
|
||||
VersionRequirementTable.create(proto.versionRequirementTable), containerSource),
|
||||
proto.functionList, proto.propertyList, proto.typeAliasList, classNames
|
||||
) {
|
||||
private val packageFqName = packageDescriptor.fqName
|
||||
|
||||
+16
-16
@@ -20,18 +20,18 @@ import org.jetbrains.kotlin.protobuf.MessageLite
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
||||
|
||||
class SinceKotlinInfoTable private constructor(private val infos: List<ProtoBuf.SinceKotlinInfo>) {
|
||||
operator fun get(id: Int): ProtoBuf.SinceKotlinInfo? = infos.getOrNull(id)
|
||||
class VersionRequirementTable private constructor(private val infos: List<ProtoBuf.VersionRequirement>) {
|
||||
operator fun get(id: Int): ProtoBuf.VersionRequirement? = infos.getOrNull(id)
|
||||
|
||||
companion object {
|
||||
val EMPTY = SinceKotlinInfoTable(emptyList())
|
||||
val EMPTY = VersionRequirementTable(emptyList())
|
||||
|
||||
fun create(table: ProtoBuf.SinceKotlinInfoTable): SinceKotlinInfoTable =
|
||||
if (table.infoCount == 0) EMPTY else SinceKotlinInfoTable(table.infoList)
|
||||
fun create(table: ProtoBuf.VersionRequirementTable): VersionRequirementTable =
|
||||
if (table.requirementCount == 0) EMPTY else VersionRequirementTable(table.requirementList)
|
||||
}
|
||||
}
|
||||
|
||||
class SinceKotlinInfo(
|
||||
class VersionRequirement(
|
||||
val version: Version,
|
||||
val level: DeprecationLevel,
|
||||
val errorCode: Int?,
|
||||
@@ -90,13 +90,13 @@ class SinceKotlinInfo(
|
||||
"since $version $level" + (if (errorCode != null) " error $errorCode" else "") + (if (message != null) ": $message" else "")
|
||||
|
||||
companion object {
|
||||
fun create(proto: MessageLite, nameResolver: NameResolver, table: SinceKotlinInfoTable): SinceKotlinInfo? {
|
||||
fun create(proto: MessageLite, nameResolver: NameResolver, table: VersionRequirementTable): VersionRequirement? {
|
||||
val id = when (proto) {
|
||||
is ProtoBuf.Class -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.Constructor -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.Function -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.Property -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.TypeAlias -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.Class -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||
is ProtoBuf.Constructor -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||
is ProtoBuf.Function -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||
is ProtoBuf.Property -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||
is ProtoBuf.TypeAlias -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||
else -> throw IllegalStateException("Unexpected declaration: ${proto::class.java}")
|
||||
}
|
||||
|
||||
@@ -108,16 +108,16 @@ class SinceKotlinInfo(
|
||||
)
|
||||
|
||||
val level = when (info.level!!) {
|
||||
ProtoBuf.SinceKotlinInfo.Level.WARNING -> DeprecationLevel.WARNING
|
||||
ProtoBuf.SinceKotlinInfo.Level.ERROR -> DeprecationLevel.ERROR
|
||||
ProtoBuf.SinceKotlinInfo.Level.HIDDEN -> DeprecationLevel.HIDDEN
|
||||
ProtoBuf.VersionRequirement.Level.WARNING -> DeprecationLevel.WARNING
|
||||
ProtoBuf.VersionRequirement.Level.ERROR -> DeprecationLevel.ERROR
|
||||
ProtoBuf.VersionRequirement.Level.HIDDEN -> DeprecationLevel.HIDDEN
|
||||
}
|
||||
|
||||
val errorCode = if (info.hasErrorCode()) info.errorCode else null
|
||||
|
||||
val message = if (info.hasMessage()) nameResolver.getString(info.message) else null
|
||||
|
||||
return SinceKotlinInfo(version, level, errorCode, message)
|
||||
return VersionRequirement(version, level, errorCode, message)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user