| 222 | // homogenous equality for comparing values. |
| 223 | template <typename EqualsProvider> |
| 224 | absl::StatusOr<absl::optional<bool>> MapEqual( |
| 225 | const MapValue& lhs, const MapValue& rhs, |
| 226 | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
| 227 | google::protobuf::MessageFactory* absl_nonnull message_factory, |
| 228 | google::protobuf::Arena* absl_nonnull arena) { |
| 229 | if (&lhs == &rhs) { |
| 230 | return true; |
| 231 | } |
| 232 | if (lhs.Size() != rhs.Size()) { |
| 233 | return false; |
| 234 | } |
| 235 | |
| 236 | CEL_ASSIGN_OR_RETURN(auto iter, lhs.NewIterator()); |
| 237 | |
| 238 | while (iter->HasNext()) { |
| 239 | CEL_ASSIGN_OR_RETURN(auto lhs_key, |
| 240 | iter->Next(descriptor_pool, message_factory, arena)); |
| 241 | |
| 242 | absl::optional<Value> entry; |
| 243 | CEL_ASSIGN_OR_RETURN( |
| 244 | entry, rhs.Find(lhs_key, descriptor_pool, message_factory, arena)); |
| 245 | |
| 246 | if (!entry && EqualsProvider::kIsHeterogeneous) { |
| 247 | CEL_ASSIGN_OR_RETURN( |
| 248 | entry, CheckAlternativeNumericType(lhs_key, rhs, descriptor_pool, |
| 249 | message_factory, arena)); |
| 250 | } |
| 251 | if (!entry) { |
| 252 | return false; |
| 253 | } |
| 254 | |
| 255 | CEL_ASSIGN_OR_RETURN(auto lhs_value, lhs.Get(lhs_key, descriptor_pool, |
| 256 | message_factory, arena)); |
| 257 | CEL_ASSIGN_OR_RETURN(absl::optional<bool> eq, |
| 258 | EqualsProvider()(lhs_value, *entry, descriptor_pool, |
| 259 | message_factory, arena)); |
| 260 | |
| 261 | if (!eq.has_value() || !*eq) { |
| 262 | return eq; |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | return true; |
| 267 | } |
| 268 | |
| 269 | // Helper for wrapping ==/!= implementations. |
| 270 | // Name should point to a static constexpr string so the lambda capture is safe. |
nothing calls this directly
no test coverage detected