| 917 | |
| 918 | private: |
| 919 | absl::StatusOr<absl::optional<ErrorValue>> SetMapField( |
| 920 | const google::protobuf::FieldDescriptor* absl_nonnull field, Value value) { |
| 921 | auto map_value = value.AsMap(); |
| 922 | if (!map_value) { |
| 923 | return TypeConversionError(value.GetTypeName(), "map"); |
| 924 | } |
| 925 | CEL_ASSIGN_OR_RETURN(auto key_converter, |
| 926 | GetProtoMapKeyFromValueConverter( |
| 927 | field->message_type()->map_key()->cpp_type())); |
| 928 | CEL_ASSIGN_OR_RETURN(auto value_converter, |
| 929 | GetProtoMapValueFromValueConverter(field)); |
| 930 | reflection_->ClearField(message_, field); |
| 931 | const auto* map_value_field = field->message_type()->map_value(); |
| 932 | absl::optional<ErrorValue> error_value; |
| 933 | // Don't replace this pattern with a status macro; nested macro invocations |
| 934 | // have the same __LINE__ on MSVC, causing CEL_ASSIGN_OR_RETURN invocations |
| 935 | // to conflict with each-other. |
| 936 | auto status = map_value->ForEach( |
| 937 | [this, field, key_converter, map_value_field, value_converter, |
| 938 | &error_value](const Value& entry_key, |
| 939 | const Value& entry_value) -> absl::StatusOr<bool> { |
| 940 | std::string proto_key_string; |
| 941 | google::protobuf::MapKey proto_key; |
| 942 | CEL_ASSIGN_OR_RETURN( |
| 943 | error_value, |
| 944 | (*key_converter)(entry_key, proto_key, proto_key_string)); |
| 945 | if (error_value) { |
| 946 | return false; |
| 947 | } |
| 948 | google::protobuf::MapValueRef proto_value; |
| 949 | extensions::protobuf_internal::InsertOrLookupMapValue( |
| 950 | *reflection_, message_, *field, proto_key, &proto_value); |
| 951 | CEL_ASSIGN_OR_RETURN( |
| 952 | error_value, |
| 953 | (*value_converter)(entry_value, map_value_field, descriptor_pool_, |
| 954 | message_factory_, &well_known_types_, |
| 955 | proto_value)); |
| 956 | if (error_value) { |
| 957 | return false; |
| 958 | } |
| 959 | return true; |
| 960 | }, |
| 961 | descriptor_pool_, message_factory_, arena_); |
| 962 | if (!status.ok()) { |
| 963 | return status; |
| 964 | } |
| 965 | return error_value; |
| 966 | } |
| 967 | |
| 968 | absl::StatusOr<absl::optional<ErrorValue>> SetRepeatedField( |
| 969 | const google::protobuf::FieldDescriptor* absl_nonnull field, Value value) { |
nothing calls this directly
no test coverage detected