| 46 | using ::cel::runtime_internal::ValueEqualImpl; |
| 47 | |
| 48 | absl::StatusOr<Value> EvaluateEquality( |
| 49 | ExecutionFrameBase& frame, const Value& lhs, const AttributeTrail& lhs_attr, |
| 50 | const Value& rhs, const AttributeTrail& rhs_attr, bool negation) { |
| 51 | if (lhs.IsError()) { |
| 52 | return lhs; |
| 53 | } |
| 54 | |
| 55 | if (rhs.IsError()) { |
| 56 | return rhs; |
| 57 | } |
| 58 | |
| 59 | if (frame.unknown_processing_enabled()) { |
| 60 | auto accu = frame.attribute_utility().CreateAccumulator(); |
| 61 | accu.MaybeAdd(lhs, lhs_attr); |
| 62 | accu.MaybeAdd(rhs, rhs_attr); |
| 63 | if (!accu.IsEmpty()) { |
| 64 | return std::move(accu).Build(); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | CEL_ASSIGN_OR_RETURN(auto is_equal, |
| 69 | ValueEqualImpl(lhs, rhs, frame.descriptor_pool(), |
| 70 | frame.message_factory(), frame.arena())); |
| 71 | if (!is_equal.has_value()) { |
| 72 | return cel::ErrorValue(cel::runtime_internal::CreateNoMatchingOverloadError( |
| 73 | negation ? cel::builtin::kInequal : cel::builtin::kEqual)); |
| 74 | } |
| 75 | return negation ? BoolValue(!*is_equal) : BoolValue(*is_equal); |
| 76 | } |
| 77 | |
| 78 | class DirectEqualityStep : public DirectExpressionStep { |
| 79 | public: |
no test coverage detected