MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / AsLegacyListValue

Function AsLegacyListValue

common/values/legacy_list_value.cc:55–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55absl::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

Callers 1

LegacyTrivialListValueFunction · 0.85

Calls 6

IsLegacyListValueFunction · 0.85
GetLegacyListValueFunction · 0.85
LegacyListValueClass · 0.70
AsCustomListMethod · 0.45
GetTypeIdMethod · 0.45
interfaceMethod · 0.45

Tested by

no test coverage detected