|
|
@ -13473,15 +13473,7 @@ upb_CType upb_FieldDef_CType(const upb_FieldDef* f) { |
|
|
|
return upb_FieldType_CType(f->type_); |
|
|
|
return upb_FieldType_CType(f->type_); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f) { |
|
|
|
upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f) { return f->type_; } |
|
|
|
// TODO: remove once we can deprecate kUpb_FieldType_Group.
|
|
|
|
|
|
|
|
if (f->type_ == kUpb_FieldType_Message && |
|
|
|
|
|
|
|
UPB_DESC(FeatureSet_message_encoding)(f->resolved_features) == |
|
|
|
|
|
|
|
UPB_DESC(FeatureSet_DELIMITED)) { |
|
|
|
|
|
|
|
return kUpb_FieldType_Group; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return f->type_; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t upb_FieldDef_Index(const upb_FieldDef* f) { return f->index_; } |
|
|
|
uint32_t upb_FieldDef_Index(const upb_FieldDef* f) { return f->index_; } |
|
|
|
|
|
|
|
|
|
|
@ -13489,14 +13481,7 @@ uint32_t upb_FieldDef_LayoutIndex(const upb_FieldDef* f) { |
|
|
|
return f->layout_index; |
|
|
|
return f->layout_index; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
upb_Label upb_FieldDef_Label(const upb_FieldDef* f) { |
|
|
|
upb_Label upb_FieldDef_Label(const upb_FieldDef* f) { return f->label_; } |
|
|
|
// TODO: remove once we can deprecate kUpb_Label_Required.
|
|
|
|
|
|
|
|
if (UPB_DESC(FeatureSet_field_presence)(f->resolved_features) == |
|
|
|
|
|
|
|
UPB_DESC(FeatureSet_LEGACY_REQUIRED)) { |
|
|
|
|
|
|
|
return kUpb_Label_Required; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return f->label_; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t upb_FieldDef_Number(const upb_FieldDef* f) { return f->number_; } |
|
|
|
uint32_t upb_FieldDef_Number(const upb_FieldDef* f) { return f->number_; } |
|
|
|
|
|
|
|
|
|
|
@ -13959,7 +13944,6 @@ static void _upb_FieldDef_Create(upb_DefBuilder* ctx, const char* prefix, |
|
|
|
|
|
|
|
|
|
|
|
const upb_StringView name = UPB_DESC(FieldDescriptorProto_name)(field_proto); |
|
|
|
const upb_StringView name = UPB_DESC(FieldDescriptorProto_name)(field_proto); |
|
|
|
f->full_name = _upb_DefBuilder_MakeFullName(ctx, prefix, name); |
|
|
|
f->full_name = _upb_DefBuilder_MakeFullName(ctx, prefix, name); |
|
|
|
f->label_ = (int)UPB_DESC(FieldDescriptorProto_label)(field_proto); |
|
|
|
|
|
|
|
f->number_ = UPB_DESC(FieldDescriptorProto_number)(field_proto); |
|
|
|
f->number_ = UPB_DESC(FieldDescriptorProto_number)(field_proto); |
|
|
|
f->is_proto3_optional = |
|
|
|
f->is_proto3_optional = |
|
|
|
UPB_DESC(FieldDescriptorProto_proto3_optional)(field_proto); |
|
|
|
UPB_DESC(FieldDescriptorProto_proto3_optional)(field_proto); |
|
|
@ -14005,6 +13989,14 @@ static void _upb_FieldDef_Create(upb_DefBuilder* ctx, const char* prefix, |
|
|
|
f->resolved_features = _upb_DefBuilder_DoResolveFeatures( |
|
|
|
f->resolved_features = _upb_DefBuilder_DoResolveFeatures( |
|
|
|
ctx, parent_features, unresolved_features, implicit); |
|
|
|
ctx, parent_features, unresolved_features, implicit); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f->label_ = (int)UPB_DESC(FieldDescriptorProto_label)(field_proto); |
|
|
|
|
|
|
|
if (f->label_ == kUpb_Label_Optional && |
|
|
|
|
|
|
|
// TODO: remove once we can deprecate kUpb_Label_Required.
|
|
|
|
|
|
|
|
UPB_DESC(FeatureSet_field_presence)(f->resolved_features) == |
|
|
|
|
|
|
|
UPB_DESC(FeatureSet_LEGACY_REQUIRED)) { |
|
|
|
|
|
|
|
f->label_ = kUpb_Label_Required; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!UPB_DESC(FieldDescriptorProto_has_name)(field_proto)) { |
|
|
|
if (!UPB_DESC(FieldDescriptorProto_has_name)(field_proto)) { |
|
|
|
_upb_DefBuilder_Errf(ctx, "field has no name"); |
|
|
|
_upb_DefBuilder_Errf(ctx, "field has no name"); |
|
|
|
} |
|
|
|
} |
|
|
@ -14024,6 +14016,12 @@ static void _upb_FieldDef_Create(upb_DefBuilder* ctx, const char* prefix, |
|
|
|
UPB_DESC(FieldDescriptorProto_has_type_name)(field_proto); |
|
|
|
UPB_DESC(FieldDescriptorProto_has_type_name)(field_proto); |
|
|
|
|
|
|
|
|
|
|
|
f->type_ = (int)UPB_DESC(FieldDescriptorProto_type)(field_proto); |
|
|
|
f->type_ = (int)UPB_DESC(FieldDescriptorProto_type)(field_proto); |
|
|
|
|
|
|
|
if (f->type_ == kUpb_FieldType_Message && |
|
|
|
|
|
|
|
// TODO: remove once we can deprecate kUpb_FieldType_Group.
|
|
|
|
|
|
|
|
UPB_DESC(FeatureSet_message_encoding)(f->resolved_features) == |
|
|
|
|
|
|
|
UPB_DESC(FeatureSet_DELIMITED)) { |
|
|
|
|
|
|
|
f->type_ = kUpb_FieldType_Group; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (has_type) { |
|
|
|
if (has_type) { |
|
|
|
switch (f->type_) { |
|
|
|
switch (f->type_) { |
|
|
|