| 430 | } |
| 431 | |
| 432 | absl::Status DirectSelectStep::PerformOptionalSelect(ExecutionFrameBase& frame, |
| 433 | const Value& value, |
| 434 | Value& result) const { |
| 435 | switch (value.kind()) { |
| 436 | case ValueKind::kStruct: { |
| 437 | auto struct_value = value.GetStruct(); |
| 438 | CEL_ASSIGN_OR_RETURN(auto ok, struct_value.HasFieldByName(field_)); |
| 439 | if (!ok) { |
| 440 | result = OptionalValue::None(); |
| 441 | return absl::OkStatus(); |
| 442 | } |
| 443 | CEL_RETURN_IF_ERROR(struct_value.GetFieldByName( |
| 444 | field_, unboxing_option_, frame.descriptor_pool(), |
| 445 | frame.message_factory(), frame.arena(), &result)); |
| 446 | ABSL_DCHECK(!result.IsUnknown()); |
| 447 | result = OptionalValue::Of(std::move(result), frame.arena()); |
| 448 | return absl::OkStatus(); |
| 449 | } |
| 450 | case ValueKind::kMap: { |
| 451 | CEL_ASSIGN_OR_RETURN( |
| 452 | auto found, |
| 453 | value.GetMap().Find(field_value_, frame.descriptor_pool(), |
| 454 | frame.message_factory(), frame.arena(), &result)); |
| 455 | if (!found) { |
| 456 | result = OptionalValue::None(); |
| 457 | return absl::OkStatus(); |
| 458 | } |
| 459 | ABSL_DCHECK(!result.IsUnknown()); |
| 460 | result = OptionalValue::Of(std::move(result), frame.arena()); |
| 461 | return absl::OkStatus(); |
| 462 | } |
| 463 | default: |
| 464 | // Control flow should have returned earlier. |
| 465 | return InvalidSelectTargetError(); |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | absl::Status DirectSelectStep::PerformSelect(ExecutionFrameBase& frame, |
| 470 | const cel::Value& value, |
nothing calls this directly
no test coverage detected