diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index 7b7806928e7f..3879fa0201d4 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -13696,11 +13696,11 @@ upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f) { } const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f) { - return upb_FieldDef_CType(f) == kUpb_CType_Message ? f->sub.msgdef : NULL; + return upb_FieldDef_IsSubMessage(f) ? f->sub.msgdef : NULL; } const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f) { - return upb_FieldDef_CType(f) == kUpb_CType_Enum ? f->sub.enumdef : NULL; + return upb_FieldDef_IsEnum(f) ? f->sub.enumdef : NULL; } const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f) { @@ -13798,8 +13798,11 @@ bool upb_FieldDef_HasDefault(const upb_FieldDef* f) { return f->has_default; } bool upb_FieldDef_HasPresence(const upb_FieldDef* f) { return f->has_presence; } bool upb_FieldDef_HasSubDef(const upb_FieldDef* f) { - return upb_FieldDef_IsSubMessage(f) || - upb_FieldDef_CType(f) == kUpb_CType_Enum; + return upb_FieldDef_IsSubMessage(f) || upb_FieldDef_IsEnum(f); +} + +bool upb_FieldDef_IsEnum(const upb_FieldDef* f) { + return upb_FieldDef_CType(f) == kUpb_CType_Enum; } bool upb_FieldDef_IsMap(const upb_FieldDef* f) { diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index fa63a63297f5..b97bd1db2b3b 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h @@ -11469,6 +11469,7 @@ bool upb_FieldDef_HasOptions(const upb_FieldDef* f); UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f); bool upb_FieldDef_HasSubDef(const upb_FieldDef* f); uint32_t upb_FieldDef_Index(const upb_FieldDef* f); +UPB_API bool upb_FieldDef_IsEnum(const upb_FieldDef* f); bool upb_FieldDef_IsExtension(const upb_FieldDef* f); UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f); bool upb_FieldDef_IsOptional(const upb_FieldDef* f); diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index d90b3eea1d0d..a426daf84f42 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -13189,11 +13189,11 @@ upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f) { } const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f) { - return upb_FieldDef_CType(f) == kUpb_CType_Message ? f->sub.msgdef : NULL; + return upb_FieldDef_IsSubMessage(f) ? f->sub.msgdef : NULL; } const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f) { - return upb_FieldDef_CType(f) == kUpb_CType_Enum ? f->sub.enumdef : NULL; + return upb_FieldDef_IsEnum(f) ? f->sub.enumdef : NULL; } const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f) { @@ -13291,8 +13291,11 @@ bool upb_FieldDef_HasDefault(const upb_FieldDef* f) { return f->has_default; } bool upb_FieldDef_HasPresence(const upb_FieldDef* f) { return f->has_presence; } bool upb_FieldDef_HasSubDef(const upb_FieldDef* f) { - return upb_FieldDef_IsSubMessage(f) || - upb_FieldDef_CType(f) == kUpb_CType_Enum; + return upb_FieldDef_IsSubMessage(f) || upb_FieldDef_IsEnum(f); +} + +bool upb_FieldDef_IsEnum(const upb_FieldDef* f) { + return upb_FieldDef_CType(f) == kUpb_CType_Enum; } bool upb_FieldDef_IsMap(const upb_FieldDef* f) { diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index 76b6af3e2b20..7307f5e25276 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h @@ -11871,6 +11871,7 @@ bool upb_FieldDef_HasOptions(const upb_FieldDef* f); UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f); bool upb_FieldDef_HasSubDef(const upb_FieldDef* f); uint32_t upb_FieldDef_Index(const upb_FieldDef* f); +UPB_API bool upb_FieldDef_IsEnum(const upb_FieldDef* f); bool upb_FieldDef_IsExtension(const upb_FieldDef* f); UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f); bool upb_FieldDef_IsOptional(const upb_FieldDef* f);