| 101 | }; |
| 102 | |
| 103 | absl::Status ExhaustiveDirectLogicStep::Evaluate( |
| 104 | ExecutionFrameBase& frame, cel::Value& result, |
| 105 | AttributeTrail& attribute_trail) const { |
| 106 | CEL_RETURN_IF_ERROR(lhs_->Evaluate(frame, result, attribute_trail)); |
| 107 | ValueKind lhs_kind = result.kind(); |
| 108 | |
| 109 | Value rhs_result; |
| 110 | AttributeTrail rhs_attr; |
| 111 | CEL_RETURN_IF_ERROR(rhs_->Evaluate(frame, rhs_result, attribute_trail)); |
| 112 | |
| 113 | ValueKind rhs_kind = rhs_result.kind(); |
| 114 | if (lhs_kind == ValueKind::kBool) { |
| 115 | bool lhs_bool = Cast<BoolValue>(result).NativeValue(); |
| 116 | if ((op_type_ == OpType::kOr && lhs_bool) || |
| 117 | (op_type_ == OpType::kAnd && !lhs_bool)) { |
| 118 | return absl::OkStatus(); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | if (rhs_kind == ValueKind::kBool) { |
| 123 | bool rhs_bool = Cast<BoolValue>(rhs_result).NativeValue(); |
| 124 | if ((op_type_ == OpType::kOr && rhs_bool) || |
| 125 | (op_type_ == OpType::kAnd && !rhs_bool)) { |
| 126 | result = std::move(rhs_result); |
| 127 | attribute_trail = std::move(rhs_attr); |
| 128 | return absl::OkStatus(); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | return ReturnLogicResult(frame, op_type_, result, rhs_result, attribute_trail, |
| 133 | rhs_attr); |
| 134 | } |
| 135 | |
| 136 | class DirectLogicStep : public DirectExpressionStep { |
| 137 | public: |
nothing calls this directly
no test coverage detected