| 53 | } |
| 54 | |
| 55 | absl::optional<LegacyListValue> AsLegacyListValue(const Value& value) { |
| 56 | if (IsLegacyListValue(value)) { |
| 57 | return GetLegacyListValue(value); |
| 58 | } |
| 59 | if (auto custom_list_value = value.AsCustomList(); custom_list_value) { |
| 60 | NativeTypeId native_type_id = custom_list_value->GetTypeId(); |
| 61 | if (native_type_id == NativeTypeId::For<CompatListValue>()) { |
| 62 | return LegacyListValue( |
| 63 | static_cast<const google::api::expr::runtime::CelList*>( |
| 64 | cel::internal::down_cast<const CompatListValue*>( |
| 65 | custom_list_value->interface()))); |
| 66 | } else if (native_type_id == NativeTypeId::For<MutableCompatListValue>()) { |
| 67 | return LegacyListValue( |
| 68 | static_cast<const google::api::expr::runtime::CelList*>( |
| 69 | cel::internal::down_cast<const MutableCompatListValue*>( |
| 70 | custom_list_value->interface()))); |
| 71 | } |
| 72 | } |
| 73 | return absl::nullopt; |
| 74 | } |
| 75 | |
| 76 | } // namespace cel::common_internal |
no test coverage detected