Cleanup descriptors.proto, regenerate
- move enums and messages nested in Callable to top level, since they're likely
to be reused in other messages soon
- delete obsolete comments: some did not any value, some became obsolete with
custom options ("id in StringTable" -> name_id_in_table)
This commit is contained in:
+1
-4
@@ -70,10 +70,7 @@ public class JvmSerializerExtension extends SerializerExtension {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeValueParameter(
|
||||
@NotNull ValueParameterDescriptor descriptor,
|
||||
@NotNull ProtoBuf.Callable.ValueParameter.Builder proto
|
||||
) {
|
||||
public void serializeValueParameter(@NotNull ValueParameterDescriptor descriptor, @NotNull ProtoBuf.ValueParameter.Builder proto) {
|
||||
Integer index = bindings.get(INDEX_FOR_VALUE_PARAMETER, descriptor);
|
||||
if (index != null) {
|
||||
proto.setExtension(JvmProtoBuf.index, index);
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ public class BuiltInsSerializerExtension : SerializerExtension() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun serializeValueParameter(descriptor: ValueParameterDescriptor, proto: ProtoBuf.Callable.ValueParameter.Builder) {
|
||||
override fun serializeValueParameter(descriptor: ValueParameterDescriptor, proto: ProtoBuf.ValueParameter.Builder) {
|
||||
for (annotation in descriptor.annotations) {
|
||||
proto.addExtension(BuiltInsProtoBuf.parameterAnnotation, annotationSerializer.serializeAnnotation(annotation))
|
||||
}
|
||||
|
||||
+6
-6
@@ -273,20 +273,20 @@ public class DescriptorSerializer {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static ProtoBuf.Callable.CallableKind callableKind(@NotNull CallableMemberDescriptor descriptor) {
|
||||
private static ProtoBuf.CallableKind callableKind(@NotNull CallableMemberDescriptor descriptor) {
|
||||
if (descriptor instanceof PropertyDescriptor) {
|
||||
return ((PropertyDescriptor) descriptor).isVar() ? ProtoBuf.Callable.CallableKind.VAR : ProtoBuf.Callable.CallableKind.VAL;
|
||||
return ((PropertyDescriptor) descriptor).isVar() ? ProtoBuf.CallableKind.VAR : ProtoBuf.CallableKind.VAL;
|
||||
}
|
||||
if (descriptor instanceof ConstructorDescriptor) {
|
||||
return ProtoBuf.Callable.CallableKind.CONSTRUCTOR;
|
||||
return ProtoBuf.CallableKind.CONSTRUCTOR;
|
||||
}
|
||||
assert descriptor instanceof FunctionDescriptor : "Unknown descriptor class: " + descriptor.getClass();
|
||||
return ProtoBuf.Callable.CallableKind.FUN;
|
||||
return ProtoBuf.CallableKind.FUN;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ProtoBuf.Callable.ValueParameter.Builder valueParameter(@NotNull ValueParameterDescriptor descriptor) {
|
||||
ProtoBuf.Callable.ValueParameter.Builder builder = ProtoBuf.Callable.ValueParameter.newBuilder();
|
||||
private ProtoBuf.ValueParameter.Builder valueParameter(@NotNull ValueParameterDescriptor descriptor) {
|
||||
ProtoBuf.ValueParameter.Builder builder = ProtoBuf.ValueParameter.newBuilder();
|
||||
|
||||
int flags = Flags.getValueParameterFlags(hasAnnotations(descriptor), descriptor.declaresDefaultValue());
|
||||
if (flags != 0) {
|
||||
|
||||
+1
-4
@@ -38,10 +38,7 @@ public abstract class SerializerExtension {
|
||||
public void serializeCallable(@NotNull CallableMemberDescriptor callable, @NotNull ProtoBuf.Callable.Builder proto) {
|
||||
}
|
||||
|
||||
public void serializeValueParameter(
|
||||
@NotNull ValueParameterDescriptor descriptor,
|
||||
@NotNull ProtoBuf.Callable.ValueParameter.Builder proto
|
||||
) {
|
||||
public void serializeValueParameter(@NotNull ValueParameterDescriptor descriptor, @NotNull ProtoBuf.ValueParameter.Builder proto) {
|
||||
}
|
||||
|
||||
public void serializeType(@NotNull JetType type, @NotNull ProtoBuf.Type.Builder proto) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+7
-7
@@ -59,11 +59,11 @@ public final class DebugBuiltInsProtoBuf {
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.getDefaultInstance());
|
||||
public static final int PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable.ValueParameter { ... }</code>
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.ValueParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Callable.ValueParameter,
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.ValueParameter,
|
||||
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> parameterAnnotation = com.google.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
||||
@@ -91,11 +91,11 @@ public final class DebugBuiltInsProtoBuf {
|
||||
"ion.Annotation:\210\001\n\022compile_time_value\022,." +
|
||||
"org.jetbrains.kotlin.serialization.Calla" +
|
||||
"ble\030\227\001 \001(\0132=.org.jetbrains.kotlin.serial" +
|
||||
"ization.Annotation.Argument.Value:\212\001\n\024pa" +
|
||||
"rameter_annotation\022;.org.jetbrains.kotli" +
|
||||
"n.serialization.Callable.ValueParameter\030" +
|
||||
"\226\001 \003(\0132..org.jetbrains.kotlin.serializat" +
|
||||
"ion.AnnotationB\027B\025DebugBuiltInsProtoBuf"
|
||||
"ization.Annotation.Argument.Value:\201\001\n\024pa" +
|
||||
"rameter_annotation\0222.org.jetbrains.kotli" +
|
||||
"n.serialization.ValueParameter\030\226\001 \003(\0132.." +
|
||||
"org.jetbrains.kotlin.serialization.Annot" +
|
||||
"ationB\027B\025DebugBuiltInsProtoBuf"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
|
||||
@@ -1836,11 +1836,11 @@ public final class DebugJsProtoBuf {
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.getDefaultInstance());
|
||||
public static final int PARAMETER_ANNOTATION_FIELD_NUMBER = 130;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable.ValueParameter { ... }</code>
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.ValueParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Callable.ValueParameter,
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.ValueParameter,
|
||||
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> parameterAnnotation = com.google.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
||||
@@ -1896,14 +1896,14 @@ public final class DebugJsProtoBuf {
|
||||
".Annotation:\210\001\n\022compile_time_value\022,.org" +
|
||||
".jetbrains.kotlin.serialization.Callable" +
|
||||
"\030\203\001 \001(\0132=.org.jetbrains.kotlin.serializa" +
|
||||
"tion.Annotation.Argument.Value:\212\001\n\024param" +
|
||||
"eter_annotation\022;.org.jetbrains.kotlin.s" +
|
||||
"erialization.Callable.ValueParameter\030\202\001 " +
|
||||
"\003(\0132..org.jetbrains.kotlin.serialization",
|
||||
".Annotation:r\n\017type_annotation\022(.org.jet" +
|
||||
"brains.kotlin.serialization.Type\030\202\001 \003(\0132" +
|
||||
"..org.jetbrains.kotlin.serialization.Ann" +
|
||||
"otationB\021B\017DebugJsProtoBuf"
|
||||
"tion.Annotation.Argument.Value:\201\001\n\024param" +
|
||||
"eter_annotation\0222.org.jetbrains.kotlin.s" +
|
||||
"erialization.ValueParameter\030\202\001 \003(\0132..org" +
|
||||
".jetbrains.kotlin.serialization.Annotati",
|
||||
"on:r\n\017type_annotation\022(.org.jetbrains.ko" +
|
||||
"tlin.serialization.Type\030\202\001 \003(\0132..org.jet" +
|
||||
"brains.kotlin.serialization.AnnotationB\021" +
|
||||
"B\017DebugJsProtoBuf"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
|
||||
@@ -4578,11 +4578,11 @@ public final class DebugJvmProtoBuf {
|
||||
null);
|
||||
public static final int INDEX_FIELD_NUMBER = 100;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable.ValueParameter { ... }</code>
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.ValueParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Callable.ValueParameter,
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.ValueParameter,
|
||||
java.lang.Integer> index = com.google.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.Integer.class,
|
||||
@@ -4672,12 +4672,12 @@ public final class DebugJvmProtoBuf {
|
||||
"rains.kotlin.serialization.Type\030d \003(\0132.." +
|
||||
"org.jetbrains.kotlin.serialization.Annot" +
|
||||
"ation:8\n\006is_raw\022(.org.jetbrains.kotlin.s",
|
||||
"erialization.Type\030e \001(\010:J\n\005index\022;.org.j" +
|
||||
"etbrains.kotlin.serialization.Callable.V" +
|
||||
"alueParameter\030d \001(\005:s\n\020class_annotation\022" +
|
||||
").org.jetbrains.kotlin.serialization.Cla" +
|
||||
"ss\030d \003(\0132..org.jetbrains.kotlin.serializ" +
|
||||
"ation.AnnotationB\022B\020DebugJvmProtoBuf"
|
||||
"erialization.Type\030e \001(\010:A\n\005index\0222.org.j" +
|
||||
"etbrains.kotlin.serialization.ValueParam" +
|
||||
"eter\030d \001(\005:s\n\020class_annotation\022).org.jet" +
|
||||
"brains.kotlin.serialization.Class\030d \003(\0132" +
|
||||
"..org.jetbrains.kotlin.serialization.Ann" +
|
||||
"otationB\022B\020DebugJvmProtoBuf"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
|
||||
@@ -107,7 +107,7 @@ extend org.jetbrains.kotlin.serialization.Type {
|
||||
optional bool is_raw = 101;
|
||||
}
|
||||
|
||||
extend org.jetbrains.kotlin.serialization.Callable.ValueParameter {
|
||||
extend org.jetbrains.kotlin.serialization.ValueParameter {
|
||||
// Index of the corresponding parameter of this method in JVM (counting receiver parameters, enum constructor synthetic parameters, etc.)
|
||||
optional int32 index = 100;
|
||||
}
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ public abstract class AbstractBinaryClassAnnotationAndConstantLoader<A : Any, C
|
||||
nameResolver: NameResolver,
|
||||
kind: AnnotatedCallableKind,
|
||||
parameterIndex: Int,
|
||||
proto: ProtoBuf.Callable.ValueParameter
|
||||
proto: ProtoBuf.ValueParameter
|
||||
): List<A> {
|
||||
val methodSignature = getCallableSignature(callable, nameResolver, kind)
|
||||
if (methodSignature != null) {
|
||||
|
||||
+3
-3
@@ -3785,14 +3785,14 @@ public final class JvmProtoBuf {
|
||||
com.google.protobuf.WireFormat.FieldType.BOOL);
|
||||
public static final int INDEX_FIELD_NUMBER = 100;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable.ValueParameter { ... }</code>
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.ValueParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.ValueParameter,
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.ValueParameter,
|
||||
java.lang.Integer> index = com.google.protobuf.GeneratedMessageLite
|
||||
.newSingularGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.ValueParameter.getDefaultInstance(),
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.ValueParameter.getDefaultInstance(),
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ class BuiltInsAnnotationAndConstantLoader(
|
||||
nameResolver: NameResolver,
|
||||
kind: AnnotatedCallableKind,
|
||||
parameterIndex: Int,
|
||||
proto: ProtoBuf.Callable.ValueParameter
|
||||
proto: ProtoBuf.ValueParameter
|
||||
): List<AnnotationDescriptor> {
|
||||
val annotations = proto.getExtension(BuiltInsProtoBuf.parameterAnnotation).orEmpty()
|
||||
return annotations.map { proto -> deserializer.deserializeAnnotation(proto, nameResolver) }
|
||||
|
||||
@@ -35,6 +35,6 @@ extend Callable {
|
||||
optional Annotation.Argument.Value compile_time_value = 151;
|
||||
}
|
||||
|
||||
extend Callable.ValueParameter {
|
||||
extend ValueParameter {
|
||||
repeated Annotation parameter_annotation = 150;
|
||||
}
|
||||
|
||||
@@ -27,10 +27,9 @@ message StringTable {
|
||||
}
|
||||
|
||||
message QualifiedNameTable {
|
||||
|
||||
message QualifiedName {
|
||||
optional int32 parent_qualified_name = 1 [default = -1];
|
||||
// Id in the StringTable
|
||||
// id in the StringTable
|
||||
required int32 short_name = 2;
|
||||
optional Kind kind = 3 [default = PACKAGE];
|
||||
|
||||
@@ -69,19 +68,17 @@ message Annotation {
|
||||
// However, to save space, this field is optional: in case of homogeneous arrays, only the type of the first element is required
|
||||
optional Type type = 1;
|
||||
|
||||
// Only one of the following values should be present. Consider using `oneof` instead when we upgrade to protobuf 2.6.0+
|
||||
// Only one of the following values should be present
|
||||
|
||||
optional sint64 int_value = 2;
|
||||
optional float float_value = 3;
|
||||
optional double double_value = 4;
|
||||
|
||||
// id in StringTable
|
||||
optional int32 string_value = 5 [(string_id_in_table) = true];
|
||||
|
||||
// If type = CLASS, FQ name id of the referenced class; if type = ENUM, FQ name id of the enum class
|
||||
// If type = CLASS, FQ name of the referenced class; if type = ENUM, FQ name of the enum class
|
||||
optional int32 class_id = 6 [(fq_name_id_in_table) = true];
|
||||
|
||||
// id in StringTable
|
||||
optional int32 enum_value_id = 7 [(name_id_in_table) = true];
|
||||
|
||||
optional Annotation annotation = 8;
|
||||
@@ -89,12 +86,10 @@ message Annotation {
|
||||
repeated Value array_element = 9;
|
||||
}
|
||||
|
||||
// id in StringTable
|
||||
required int32 name_id = 1 [(name_id_in_table) = true];
|
||||
required Value value = 2;
|
||||
}
|
||||
|
||||
// Class FQ name id
|
||||
required int32 id = 1 [(fq_name_id_in_table) = true];
|
||||
|
||||
repeated Argument argument = 2;
|
||||
@@ -117,27 +112,23 @@ message Type {
|
||||
|
||||
optional bool nullable = 3 [default = false];
|
||||
|
||||
// Id in the StringTable
|
||||
// If this field is set, the type is flexible.
|
||||
// All the other fields and extensions represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
|
||||
optional int32 flexible_type_capabilities_id = 4 [(string_id_in_table) = true];
|
||||
|
||||
// While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
|
||||
// we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
|
||||
// to represent flexible types is too many wasted bytes.
|
||||
optional Type flexible_upper_bound = 5;
|
||||
|
||||
// Only one of the following values should be present. Consider using `oneof` instead when we upgrade to protobuf 2.6.0+
|
||||
// Only one of the following values should be present
|
||||
|
||||
optional int32 class_name = 6 [(fq_name_id_in_table) = true]; // fqName id
|
||||
optional int32 type_parameter = 7; // type parameter id
|
||||
optional int32 class_name = 6 [(fq_name_id_in_table) = true];
|
||||
optional int32 type_parameter = 7; // id of the type parameter
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
message TypeParameter {
|
||||
required int32 id = 1;
|
||||
// Id in the StringTable
|
||||
|
||||
required int32 name = 2 [(name_id_in_table) = true];
|
||||
|
||||
optional bool reified = 3 [default = false];
|
||||
@@ -165,24 +156,21 @@ message Class {
|
||||
}
|
||||
|
||||
/*
|
||||
Visibility
|
||||
Modality
|
||||
has_annotation
|
||||
ClassKind
|
||||
is_inner
|
||||
*/
|
||||
Visibility
|
||||
Modality
|
||||
hasAnnotations
|
||||
ClassKind
|
||||
isInner
|
||||
*/
|
||||
optional int32 flags = 1 [default = 0 /*internal final class, no annotations*/];
|
||||
|
||||
required int32 fq_name = 3 [(fq_name_id_in_table) = true];
|
||||
|
||||
// If this field is present, it contains the name of companion object.
|
||||
optional int32 companion_object_name = 4 [(name_id_in_table) = true];
|
||||
|
||||
repeated TypeParameter type_parameter = 5;
|
||||
repeated Type supertype = 6;
|
||||
|
||||
// we store only names, because the actual information must reside in the corresponding .class files,
|
||||
// to be obtainable through reflection at runtime
|
||||
repeated int32 nested_class_name = 7 [packed = true, (name_id_in_table) = true];
|
||||
|
||||
repeated Callable member = 11;
|
||||
@@ -210,44 +198,28 @@ message Package {
|
||||
}
|
||||
|
||||
message Callable {
|
||||
enum MemberKind {
|
||||
// 2 bits
|
||||
DECLARATION = 0;
|
||||
FAKE_OVERRIDE = 1;
|
||||
DELEGATION = 2;
|
||||
SYNTHESIZED = 3;
|
||||
}
|
||||
|
||||
enum CallableKind {
|
||||
// 2 bits
|
||||
FUN = 0;
|
||||
VAL = 1;
|
||||
VAR = 2;
|
||||
CONSTRUCTOR = 3;
|
||||
}
|
||||
|
||||
/*
|
||||
Visibility
|
||||
Modality
|
||||
has_annotations
|
||||
CallableKind
|
||||
MemberKind
|
||||
hasGetter
|
||||
hasSetter
|
||||
hasConstant
|
||||
isConst
|
||||
lateinit
|
||||
isOperator
|
||||
isInfix
|
||||
*/
|
||||
Visibility
|
||||
Modality
|
||||
hasAnnotations
|
||||
CallableKind
|
||||
MemberKind
|
||||
hasGetter
|
||||
hasSetter
|
||||
hasConstant
|
||||
isConst
|
||||
lateinit
|
||||
isOperator
|
||||
isInfix
|
||||
*/
|
||||
optional int32 flags = 1;
|
||||
|
||||
/*
|
||||
isNotDefault
|
||||
Visibility
|
||||
Modality
|
||||
has_annotations
|
||||
*/
|
||||
isNotDefault
|
||||
Visibility
|
||||
Modality
|
||||
hasAnnotations
|
||||
*/
|
||||
optional int32 getter_flags = 9 /* absent => same as property */;
|
||||
optional int32 setter_flags = 10 /* absent => same as property */;
|
||||
|
||||
@@ -255,24 +227,8 @@ message Callable {
|
||||
|
||||
optional Type receiver_type = 5;
|
||||
|
||||
// Id in the StringTable
|
||||
required int32 name = 6 [(name_id_in_table) = true];
|
||||
|
||||
message ValueParameter {
|
||||
/*
|
||||
declaresDefault
|
||||
has_annotations
|
||||
*/
|
||||
optional int32 flags = 1;
|
||||
|
||||
// Id in the StringTable
|
||||
required int32 name = 2 [(name_id_in_table) = true];
|
||||
required Type type = 3;
|
||||
optional Type vararg_element_type = 4;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
// Value parameters for functions and constructors, or setter value parameter for properties
|
||||
repeated ValueParameter value_parameter = 7;
|
||||
|
||||
@@ -281,6 +237,22 @@ message Callable {
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
message ValueParameter {
|
||||
/*
|
||||
declaresDefault
|
||||
hasAnnotations
|
||||
*/
|
||||
optional int32 flags = 1;
|
||||
|
||||
required int32 name = 2 [(name_id_in_table) = true];
|
||||
|
||||
required Type type = 3;
|
||||
|
||||
optional Type vararg_element_type = 4;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
enum Modality {
|
||||
// 2 bits
|
||||
FINAL = 0x00;
|
||||
@@ -298,3 +270,19 @@ enum Visibility {
|
||||
PRIVATE_TO_THIS = 0x04;
|
||||
LOCAL = 0x05;
|
||||
}
|
||||
|
||||
enum CallableKind {
|
||||
// 2 bits
|
||||
FUN = 0;
|
||||
VAL = 1;
|
||||
VAR = 2;
|
||||
CONSTRUCTOR = 3;
|
||||
}
|
||||
|
||||
enum MemberKind {
|
||||
// 2 bits
|
||||
DECLARATION = 0;
|
||||
FAKE_OVERRIDE = 1;
|
||||
DELEGATION = 2;
|
||||
SYNTHESIZED = 3;
|
||||
}
|
||||
|
||||
@@ -39,11 +39,9 @@ public class Flags {
|
||||
|
||||
// Callables
|
||||
|
||||
public static final FlagField<ProtoBuf.Callable.CallableKind> CALLABLE_KIND = FlagField.after(MODALITY,
|
||||
ProtoBuf.Callable.CallableKind.values());
|
||||
public static final FlagField<ProtoBuf.CallableKind> CALLABLE_KIND = FlagField.after(MODALITY, ProtoBuf.CallableKind.values());
|
||||
|
||||
public static final FlagField<ProtoBuf.Callable.MemberKind> MEMBER_KIND = FlagField.after(CALLABLE_KIND,
|
||||
ProtoBuf.Callable.MemberKind.values());
|
||||
public static final FlagField<ProtoBuf.MemberKind> MEMBER_KIND = FlagField.after(CALLABLE_KIND, ProtoBuf.MemberKind.values());
|
||||
public static final FlagField<Boolean> HAS_GETTER = FlagField.booleanAfter(MEMBER_KIND);
|
||||
public static final FlagField<Boolean> HAS_SETTER = FlagField.booleanAfter(HAS_GETTER);
|
||||
public static final FlagField<Boolean> HAS_CONSTANT = FlagField.booleanAfter(HAS_SETTER);
|
||||
@@ -117,7 +115,7 @@ public class Flags {
|
||||
@NotNull Visibility visibility,
|
||||
@NotNull Modality modality,
|
||||
@NotNull CallableMemberDescriptor.Kind memberKind,
|
||||
@NotNull ProtoBuf.Callable.CallableKind callableKind,
|
||||
@NotNull ProtoBuf.CallableKind callableKind,
|
||||
boolean hasGetter,
|
||||
boolean hasSetter,
|
||||
boolean hasConstant,
|
||||
@@ -193,16 +191,16 @@ public class Flags {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static ProtoBuf.Callable.MemberKind memberKind(@NotNull CallableMemberDescriptor.Kind kind) {
|
||||
private static ProtoBuf.MemberKind memberKind(@NotNull CallableMemberDescriptor.Kind kind) {
|
||||
switch (kind) {
|
||||
case DECLARATION:
|
||||
return ProtoBuf.Callable.MemberKind.DECLARATION;
|
||||
return ProtoBuf.MemberKind.DECLARATION;
|
||||
case FAKE_OVERRIDE:
|
||||
return ProtoBuf.Callable.MemberKind.FAKE_OVERRIDE;
|
||||
return ProtoBuf.MemberKind.FAKE_OVERRIDE;
|
||||
case DELEGATION:
|
||||
return ProtoBuf.Callable.MemberKind.DELEGATION;
|
||||
return ProtoBuf.MemberKind.DELEGATION;
|
||||
case SYNTHESIZED:
|
||||
return ProtoBuf.Callable.MemberKind.SYNTHESIZED;
|
||||
return ProtoBuf.MemberKind.SYNTHESIZED;
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown member kind: " + kind);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -75,14 +75,14 @@ public final class BuiltInsProtoBuf {
|
||||
com.google.protobuf.WireFormat.FieldType.MESSAGE);
|
||||
public static final int PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable.ValueParameter { ... }</code>
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.ValueParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.ValueParameter,
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.ValueParameter,
|
||||
java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation>> parameterAnnotation = com.google.protobuf.GeneratedMessageLite
|
||||
.newRepeatedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.ValueParameter.getDefaultInstance(),
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.ValueParameter.getDefaultInstance(),
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.getDefaultInstance(),
|
||||
null,
|
||||
150,
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public interface AnnotationAndConstantLoader<A, C, T> {
|
||||
@NotNull NameResolver nameResolver,
|
||||
@NotNull AnnotatedCallableKind kind,
|
||||
int parameterIndex,
|
||||
@NotNull ProtoBuf.Callable.ValueParameter proto
|
||||
@NotNull ProtoBuf.ValueParameter proto
|
||||
);
|
||||
|
||||
@NotNull
|
||||
|
||||
+6
-5
@@ -25,10 +25,11 @@ import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
||||
import org.jetbrains.kotlin.resolve.DescriptorFactory
|
||||
import org.jetbrains.kotlin.serialization.Flags
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind.FUN
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind.VAL
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind.VAR
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.CallableKind.FUN
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.CallableKind.VAL
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.CallableKind.VAR
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.*
|
||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||
|
||||
@@ -50,7 +51,7 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
||||
getAnnotations(proto, flags, AnnotatedCallableKind.PROPERTY),
|
||||
Deserialization.modality(Flags.MODALITY.get(flags)),
|
||||
Deserialization.visibility(Flags.VISIBILITY.get(flags)),
|
||||
Flags.CALLABLE_KIND.get(flags) == Callable.CallableKind.VAR,
|
||||
Flags.CALLABLE_KIND.get(flags) == ProtoBuf.CallableKind.VAR,
|
||||
c.nameResolver.getName(proto.getName()),
|
||||
Deserialization.memberKind(Flags.MEMBER_KIND.get(flags)),
|
||||
proto,
|
||||
@@ -230,7 +231,7 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
||||
callable: Callable,
|
||||
kind: AnnotatedCallableKind,
|
||||
index: Int,
|
||||
valueParameter: Callable.ValueParameter
|
||||
valueParameter: ProtoBuf.ValueParameter
|
||||
): Annotations {
|
||||
return DeserializedAnnotations(c.storageManager) {
|
||||
c.components.annotationAndConstantLoader.loadValueParameterAnnotations(
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl
|
||||
import org.jetbrains.kotlin.serialization.Flags
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.CallableKind
|
||||
import org.jetbrains.kotlin.serialization.deserialization.DeserializationContext
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||
|
||||
+5
-5
@@ -26,11 +26,11 @@ import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
object Deserialization {
|
||||
@JvmStatic
|
||||
fun memberKind(memberKind: ProtoBuf.Callable.MemberKind) = when (memberKind) {
|
||||
ProtoBuf.Callable.MemberKind.DECLARATION -> CallableMemberDescriptor.Kind.DECLARATION
|
||||
ProtoBuf.Callable.MemberKind.FAKE_OVERRIDE -> CallableMemberDescriptor.Kind.FAKE_OVERRIDE
|
||||
ProtoBuf.Callable.MemberKind.DELEGATION -> CallableMemberDescriptor.Kind.DELEGATION
|
||||
ProtoBuf.Callable.MemberKind.SYNTHESIZED -> CallableMemberDescriptor.Kind.SYNTHESIZED
|
||||
fun memberKind(memberKind: ProtoBuf.MemberKind) = when (memberKind) {
|
||||
ProtoBuf.MemberKind.DECLARATION -> CallableMemberDescriptor.Kind.DECLARATION
|
||||
ProtoBuf.MemberKind.FAKE_OVERRIDE -> CallableMemberDescriptor.Kind.FAKE_OVERRIDE
|
||||
ProtoBuf.MemberKind.DELEGATION -> CallableMemberDescriptor.Kind.DELEGATION
|
||||
ProtoBuf.MemberKind.SYNTHESIZED -> CallableMemberDescriptor.Kind.SYNTHESIZED
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class AnnotationLoaderForKotlinJavaScriptStubBuilder() : AnnotationAndCon
|
||||
nameResolver: NameResolver,
|
||||
kind: AnnotatedCallableKind,
|
||||
parameterIndex: Int,
|
||||
proto: ProtoBuf.Callable.ValueParameter
|
||||
proto: ProtoBuf.ValueParameter
|
||||
): List<ClassId> =
|
||||
proto.getExtension(JsProtoBuf.parameterAnnotation).orEmpty().map { nameResolver.getClassId(it.id) }
|
||||
|
||||
|
||||
+6
-6
@@ -27,8 +27,8 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinPropertyStubImpl
|
||||
import org.jetbrains.kotlin.resolve.dataClassUtils.isComponentLike
|
||||
import org.jetbrains.kotlin.serialization.Flags
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.MemberKind
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.CallableKind
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.MemberKind
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Modality
|
||||
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
||||
import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer
|
||||
@@ -64,7 +64,7 @@ private class CallableClsStubBuilder(
|
||||
private val typeStubBuilder = TypeClsStubBuilder(c)
|
||||
private val isTopLevel: Boolean get() = protoContainer.packageFqName != null
|
||||
private val callableKind = Flags.CALLABLE_KIND[callableProto.getFlags()]
|
||||
private val isConstructor = callableKind == ProtoBuf.Callable.CallableKind.CONSTRUCTOR
|
||||
private val isConstructor = callableKind == CallableKind.CONSTRUCTOR
|
||||
private val isPrimaryConstructor = isConstructor && parent is KotlinClassStubImpl
|
||||
private val callableStub = doCreateCallableStub()
|
||||
|
||||
@@ -118,7 +118,7 @@ private class CallableClsStubBuilder(
|
||||
val callableName = c.nameResolver.getName(callableProto.getName())
|
||||
|
||||
return when (callableKind) {
|
||||
ProtoBuf.Callable.CallableKind.FUN -> {
|
||||
CallableKind.FUN -> {
|
||||
KotlinFunctionStubImpl(
|
||||
parent,
|
||||
callableName.ref(),
|
||||
@@ -130,7 +130,7 @@ private class CallableClsStubBuilder(
|
||||
hasTypeParameterListBeforeFunctionName = callableProto.getTypeParameterList().isNotEmpty()
|
||||
)
|
||||
}
|
||||
ProtoBuf.Callable.CallableKind.VAL, ProtoBuf.Callable.CallableKind.VAR -> {
|
||||
CallableKind.VAL, CallableKind.VAR -> {
|
||||
KotlinPropertyStubImpl(
|
||||
parent,
|
||||
callableName.ref(),
|
||||
@@ -144,7 +144,7 @@ private class CallableClsStubBuilder(
|
||||
fqName = c.containerFqName.child(callableName)
|
||||
)
|
||||
}
|
||||
ProtoBuf.Callable.CallableKind.CONSTRUCTOR -> {
|
||||
CallableKind.CONSTRUCTOR -> {
|
||||
if (isPrimaryConstructor)
|
||||
KotlinPlaceHolderStubImpl(parent, JetStubElementTypes.PRIMARY_CONSTRUCTOR)
|
||||
else
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.*
|
||||
import org.jetbrains.kotlin.serialization.Flags
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.CallableKind
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Type
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Type.Argument.Projection
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter.Variance
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.*
|
||||
import org.jetbrains.kotlin.serialization.Flags
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.CallableKind
|
||||
import org.jetbrains.kotlin.serialization.deserialization.AnnotatedCallableKind
|
||||
import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer
|
||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
||||
|
||||
@@ -270,7 +270,7 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
return true
|
||||
}
|
||||
|
||||
open fun checkEquals(old: ProtoBuf.Callable.ValueParameter, new: ProtoBuf.Callable.ValueParameter): Boolean {
|
||||
open fun checkEquals(old: ProtoBuf.ValueParameter, new: ProtoBuf.ValueParameter): Boolean {
|
||||
if (old.hasFlags() != new.hasFlags()) return false
|
||||
if (old.hasFlags()) {
|
||||
if (old.flags != new.flags) return false
|
||||
@@ -753,7 +753,7 @@ public fun ProtoBuf.Annotation.hashCode(stringIndexes: (Int) -> Int, fqNameIndex
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.Callable.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
public fun ProtoBuf.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasFlags()) {
|
||||
|
||||
@@ -30,7 +30,7 @@ extend Callable {
|
||||
optional Annotation.Argument.Value compile_time_value = 131;
|
||||
}
|
||||
|
||||
extend Callable.ValueParameter {
|
||||
extend ValueParameter {
|
||||
repeated Annotation parameter_annotation = 130;
|
||||
}
|
||||
|
||||
|
||||
@@ -1509,14 +1509,14 @@ public final class JsProtoBuf {
|
||||
com.google.protobuf.WireFormat.FieldType.MESSAGE);
|
||||
public static final int PARAMETER_ANNOTATION_FIELD_NUMBER = 130;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable.ValueParameter { ... }</code>
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.ValueParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.ValueParameter,
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.ValueParameter,
|
||||
java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation>> parameterAnnotation = com.google.protobuf.GeneratedMessageLite
|
||||
.newRepeatedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.ValueParameter.getDefaultInstance(),
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.ValueParameter.getDefaultInstance(),
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.getDefaultInstance(),
|
||||
null,
|
||||
130,
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ class KotlinJavascriptAnnotationAndConstantLoader(
|
||||
nameResolver: NameResolver,
|
||||
kind: AnnotatedCallableKind,
|
||||
parameterIndex: Int,
|
||||
proto: ProtoBuf.Callable.ValueParameter
|
||||
proto: ProtoBuf.ValueParameter
|
||||
): List<AnnotationDescriptor> {
|
||||
val annotations = proto.getExtension(JsProtoBuf.parameterAnnotation).orEmpty()
|
||||
return annotations.map { proto -> deserializer.deserializeAnnotation(proto, nameResolver) }
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class KotlinJavascriptSerializerExtension : SerializerExtension() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun serializeValueParameter(descriptor: ValueParameterDescriptor, proto: ProtoBuf.Callable.ValueParameter.Builder) {
|
||||
override fun serializeValueParameter(descriptor: ValueParameterDescriptor, proto: ProtoBuf.ValueParameter.Builder) {
|
||||
for (annotation in descriptor.annotations) {
|
||||
proto.addExtension(JsProtoBuf.parameterAnnotation, annotationSerializer.serializeAnnotation(annotation))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user