@@ -1091,8 +1091,11 @@ public final class FieldDescriptor {
1091
1091
1092
1092
/// This should never be called directly. Use isRequired and isRepeated
1093
1093
/// helper methods instead.
1094
- // TODO(thomasvl): @available(*, deprecated, message: "Use isRequired or isRepeated instead.")
1095
- public let label : Google_Protobuf_FieldDescriptorProto . Label
1094
+ @available ( * , deprecated, message: " Use isRequired or isRepeated instead. " )
1095
+ public var label : Google_Protobuf_FieldDescriptorProto . Label { _label }
1096
+
1097
+ // Storage for `label`, used by other apis.
1098
+ private var _label : Google_Protobuf_FieldDescriptorProto . Label
1096
1099
1097
1100
/// Whether or not the field is required. For proto2 required fields and
1098
1101
/// Editions `LEGACY_REQUIRED` fields.
@@ -1101,7 +1104,7 @@ public final class FieldDescriptor {
1101
1104
features. fieldPresence == . legacyRequired
1102
1105
}
1103
1106
/// Whether or not the field is repeated/map field.
1104
- public var isRepeated : Bool { label == . repeated }
1107
+ public var isRepeated : Bool { _label == . repeated }
1105
1108
1106
1109
/// Use !isRequired() && !isRepeated() instead.
1107
1110
@available ( * , deprecated, message: " Use !isRequired && !isRepeated instead. " )
@@ -1129,7 +1132,7 @@ public final class FieldDescriptor {
1129
1132
var _hasOptionalKeyword : Bool {
1130
1133
// This logic comes from the C++ FieldDescriptor::has_optional_keyword()
1131
1134
// impl.
1132
- proto3Optional || ( file. edition == . proto2 && label == . optional && oneofIndex == nil )
1135
+ proto3Optional || ( file. edition == . proto2 && _label == . optional && oneofIndex == nil )
1133
1136
}
1134
1137
@available ( * , deprecated, message: " Please open a GitHub issue if you think functionality is missing. " )
1135
1138
public var hasOptionalKeyword : Bool {
@@ -1346,9 +1349,9 @@ public final class FieldDescriptor {
1346
1349
// helper instead of access `label` directly, they won't need this, but for
1347
1350
// consistency, remap `label` to expose the pre Editions/Features value.
1348
1351
if self . features. fieldPresence == . legacyRequired && proto. label == . optional {
1349
- self . label = . required
1352
+ self . _label = . required
1350
1353
} else {
1351
- self . label = proto. label
1354
+ self . _label = proto. label
1352
1355
}
1353
1356
self . options = proto. options
1354
1357
self . oneofIndex = proto. hasOneofIndex ? proto. oneofIndex : nil
0 commit comments