Value parameters flags supported
This commit is contained in:
committed by
Alexander Udalov
parent
2e978950ab
commit
655db3ca44
+1
-2
@@ -299,8 +299,7 @@ public class DescriptorDeserializer {
|
|||||||
Collections.<AnnotationDescriptor>emptyList(),
|
Collections.<AnnotationDescriptor>emptyList(),
|
||||||
nameResolver.getName(proto.getName()),
|
nameResolver.getName(proto.getName()),
|
||||||
typeDeserializer.type(proto.getType()),
|
typeDeserializer.type(proto.getType()),
|
||||||
// TODO: declaresDefaultValue
|
Flags.declaresDefaultValue(proto.getFlags()),
|
||||||
false,
|
|
||||||
typeDeserializer.typeOrNull(proto.hasVarargElementType() ? proto.getVarargElementType() : null));
|
typeDeserializer.typeOrNull(proto.hasVarargElementType() ? proto.getVarargElementType() : null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-6
@@ -147,7 +147,7 @@ public class DescriptorSerializer {
|
|||||||
private ProtoBuf.Callable.ValueParameter.Builder valueParameter(ValueParameterDescriptor descriptor) {
|
private ProtoBuf.Callable.ValueParameter.Builder valueParameter(ValueParameterDescriptor descriptor) {
|
||||||
ProtoBuf.Callable.ValueParameter.Builder builder = ProtoBuf.Callable.ValueParameter.newBuilder();
|
ProtoBuf.Callable.ValueParameter.Builder builder = ProtoBuf.Callable.ValueParameter.newBuilder();
|
||||||
|
|
||||||
builder.setFlags(flags(descriptor));
|
builder.setFlags(Flags.getValueParameterFlags(descriptor.declaresDefaultValue()));
|
||||||
|
|
||||||
builder.setName(nameTable.getSimpleNameIndex(descriptor.getName()));
|
builder.setName(nameTable.getSimpleNameIndex(descriptor.getName()));
|
||||||
|
|
||||||
@@ -161,11 +161,6 @@ public class DescriptorSerializer {
|
|||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int flags(ValueParameterDescriptor descriptor) {
|
|
||||||
// TODO
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ProtoBuf.TypeParameter.Builder typeParameter(TypeParameterDescriptor typeParameter) {
|
private ProtoBuf.TypeParameter.Builder typeParameter(TypeParameterDescriptor typeParameter) {
|
||||||
ProtoBuf.TypeParameter.Builder builder = ProtoBuf.TypeParameter.newBuilder();
|
ProtoBuf.TypeParameter.Builder builder = ProtoBuf.TypeParameter.newBuilder();
|
||||||
|
|
||||||
|
|||||||
+15
@@ -33,6 +33,11 @@ public class Flags {
|
|||||||
public static final int INLINE_BIT_COUNT = 1;
|
public static final int INLINE_BIT_COUNT = 1;
|
||||||
public static final int INLINE_OFFSET = MEMBER_KIND_OFFSET + MEMBER_KIND_BIT_COUNT;
|
public static final int INLINE_OFFSET = MEMBER_KIND_OFFSET + MEMBER_KIND_BIT_COUNT;
|
||||||
|
|
||||||
|
// Parameters
|
||||||
|
|
||||||
|
public static final int DECLARES_DEFAULT_VALUE_BIT_COUNT = 1;
|
||||||
|
public static final int DECLARES_DEFAULT_VALUE_OFFSET = 0;
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
private static final Boolean[] BOOLEANS = { false, true };
|
private static final Boolean[] BOOLEANS = { false, true };
|
||||||
@@ -87,6 +92,10 @@ public class Flags {
|
|||||||
return getValue(flags, BOOLEANS, INLINE_BIT_COUNT, INLINE_OFFSET);
|
return getValue(flags, BOOLEANS, INLINE_BIT_COUNT, INLINE_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean declaresDefaultValue(int flags) {
|
||||||
|
return getValue(flags, BOOLEANS, DECLARES_DEFAULT_VALUE_BIT_COUNT, DECLARES_DEFAULT_VALUE_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
public static int getClassFlags(Visibility visibility, Modality modality, ClassKind kind, boolean inner) {
|
public static int getClassFlags(Visibility visibility, Modality modality, ClassKind kind, boolean inner) {
|
||||||
int visibilityInt = visibility(visibility).getNumber();
|
int visibilityInt = visibility(visibility).getNumber();
|
||||||
int modalityInt = modality(modality).getNumber();
|
int modalityInt = modality(modality).getNumber();
|
||||||
@@ -183,4 +192,10 @@ public class Flags {
|
|||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unknown member kind: " + kind);
|
throw new IllegalArgumentException("Unknown member kind: " + kind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getValueParameterFlags(boolean declaresDefaultValue) {
|
||||||
|
int declaresDefaultValueInt = declaresDefaultValue ? 1 : 0;
|
||||||
|
return declaresDefaultValueInt << DECLARES_DEFAULT_VALUE_OFFSET
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user