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

Function AsLegacyMapValue

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

Source from the content-addressed store, hash-verified

53}
54
55absl::optional<LegacyMapValue> AsLegacyMapValue(const Value& value) {
56 if (IsLegacyMapValue(value)) {
57 return GetLegacyMapValue(value);
58 }
59 if (auto custom_map_value = value.AsCustomMap(); custom_map_value) {
60 NativeTypeId native_type_id = NativeTypeId::Of(*custom_map_value);
61 if (native_type_id == NativeTypeId::For<CompatMapValue>()) {
62 return LegacyMapValue(
63 static_cast<const google::api::expr::runtime::CelMap*>(
64 cel::internal::down_cast<const CompatMapValue*>(
65 custom_map_value->interface())));
66 } else if (native_type_id == NativeTypeId::For<MutableCompatMapValue>()) {
67 return LegacyMapValue(
68 static_cast<const google::api::expr::runtime::CelMap*>(
69 cel::internal::down_cast<const MutableCompatMapValue*>(
70 custom_map_value->interface())));
71 }
72 }
73 return absl::nullopt;
74}
75
76} // namespace cel::common_internal

Callers 1

LegacyTrivialMapValueFunction · 0.85

Calls 6

IsLegacyMapValueFunction · 0.85
GetLegacyMapValueFunction · 0.85
OfFunction · 0.85
LegacyMapValueClass · 0.70
AsCustomMapMethod · 0.45
interfaceMethod · 0.45

Tested by

no test coverage detected