Bugfix for when UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 is being used

This is not easy to test in google3 since we do not use the flag in Google3. It is only used for Ruby.

PiperOrigin-RevId: 478071539
pull/13171/head
Joshua Haberman 2 years ago committed by Copybara-Service
parent e1b11b67a0
commit 128ac1c935
  1. 7
      upb/reflection/field_def.c

@ -285,11 +285,8 @@ uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f) {
break; break;
} }
if (f->type_ == kUpb_FieldType_Enum) { if (_upb_FieldDef_IsClosedEnum(f)) {
const upb_FileDef* file_def = upb_EnumDef_File(upb_FieldDef_EnumSubDef(f)); out |= kUpb_FieldModifier_IsClosedEnum;
if (upb_FileDef_Syntax(file_def) == kUpb_Syntax_Proto2) {
out |= kUpb_FieldModifier_IsClosedEnum;
}
} }
return out; return out;
} }

Loading…
Cancel
Save