Add JvmFlags, use flags field instead of is_moved_from_interface_companion
To be able to add more property-related flags into the same int field later
This commit is contained in:
@@ -102,7 +102,11 @@ extend Function {
|
||||
|
||||
extend Property {
|
||||
optional JvmPropertySignature property_signature = 100;
|
||||
optional int32 is_moved_from_interface_companion = 101;
|
||||
|
||||
/**
|
||||
isMovedFromInterfaceCompanion true if this property is declared in an interface companion, and the field is stored in the interface
|
||||
*/
|
||||
optional int32 flags = 101 [default = 0];
|
||||
}
|
||||
|
||||
extend Type {
|
||||
|
||||
@@ -11,7 +11,7 @@ public final class JvmProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf.methodSignature);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf.lambdaClassOriginName);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf.propertySignature);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf.isMovedFromInterfaceCompanion);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf.flags);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf.typeAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf.isRaw);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf.typeParameterAnnotation);
|
||||
@@ -3859,14 +3859,19 @@ public final class JvmProtoBuf {
|
||||
100,
|
||||
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE,
|
||||
org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf.JvmPropertySignature.class);
|
||||
public static final int IS_MOVED_FROM_INTERFACE_COMPANION_FIELD_NUMBER = 101;
|
||||
public static final int FLAGS_FIELD_NUMBER = 101;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
|
||||
*
|
||||
* <pre>
|
||||
**
|
||||
*isMovedFromInterfaceCompanion true if this property is declared in an interface companion, and the field is stored in the interface
|
||||
* </pre>
|
||||
*/
|
||||
public static final
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
|
||||
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
|
||||
java.lang.Integer> isMovedFromInterfaceCompanion = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
|
||||
java.lang.Integer> flags = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
|
||||
.newSingularGeneratedExtension(
|
||||
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
|
||||
0,
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.metadata.jvm.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.metadata.deserialization.Flags
|
||||
|
||||
/**
|
||||
* @see Flags
|
||||
*/
|
||||
object JvmFlags {
|
||||
// Properties
|
||||
|
||||
val IS_MOVED_FROM_INTERFACE_COMPANION = Flags.FlagField.booleanFirst()
|
||||
|
||||
fun getPropertyFlags(isMovedFromInterfaceCompanion: Boolean): Int =
|
||||
IS_MOVED_FROM_INTERFACE_COMPANION.toFlags(isMovedFromInterfaceCompanion)
|
||||
}
|
||||
+2
-2
@@ -121,6 +121,6 @@ object JvmProtoBufUtil {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isMovedFromInterfaceCompanion(proto: ProtoBuf.Property) =
|
||||
proto.getExtension(JvmProtoBuf.isMovedFromInterfaceCompanion).toInt().and(1) != 0
|
||||
fun isMovedFromInterfaceCompanion(proto: ProtoBuf.Property): Boolean =
|
||||
JvmFlags.IS_MOVED_FROM_INTERFACE_COMPANION.get(proto.getExtension(JvmProtoBuf.flags))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user