Generate hazzers for Ruby oneof fields in proto3

pull/11653/head
Charles OuGuo 2 years ago
parent 8915a5ae42
commit e3edf2c2d9
  1. 9
      ruby/ext/google/protobuf_c/message.c

@ -243,15 +243,6 @@ static int extract_method_call(VALUE method_name, Message* self,
if (Match(m, name, f, o, "clear_", "")) return METHOD_CLEAR;
if (Match(m, name, f, o, "has_", "?") &&
(*o || (*f && upb_FieldDef_HasPresence(*f)))) {
// Disallow oneof hazzers for proto3.
// TODO(haberman): remove this test when we are enabling oneof hazzers for
// proto3.
if (*f && !upb_FieldDef_IsSubMessage(*f) &&
upb_FieldDef_RealContainingOneof(*f) &&
upb_MessageDef_Syntax(upb_FieldDef_ContainingType(*f)) !=
kUpb_Syntax_Proto2) {
return METHOD_UNKNOWN;
}
return METHOD_PRESENCE;
}
if (Match(m, name, f, o, "", "_as_value") && *f &&

Loading…
Cancel
Save