Coverage Report

Created: 2026-07-11 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/proc/self/cwd/common/values/map_value.cc
Line
Count
Source
1
// Copyright 2023 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include <cstddef>
16
#include <string>
17
#include <utility>
18
19
#include "absl/base/attributes.h"
20
#include "absl/base/nullability.h"
21
#include "absl/log/absl_check.h"
22
#include "absl/status/status.h"
23
#include "absl/status/statusor.h"
24
#include "absl/strings/str_cat.h"
25
#include "absl/types/optional.h"
26
#include "common/native_type.h"
27
#include "common/optional_ref.h"
28
#include "common/value.h"
29
#include "common/value_kind.h"
30
#include "common/values/value_variant.h"
31
#include "internal/status_macros.h"
32
#include "google/protobuf/arena.h"
33
#include "google/protobuf/descriptor.h"
34
#include "google/protobuf/io/zero_copy_stream.h"
35
#include "google/protobuf/message.h"
36
37
namespace cel {
38
39
namespace {
40
41
349
absl::Status InvalidMapKeyTypeError(ValueKind kind) {
42
349
  return absl::InvalidArgumentError(
43
349
      absl::StrCat("Invalid map key type: '", ValueKindToString(kind), "'"));
44
349
}
45
46
}  // namespace
47
48
0
NativeTypeId MapValue::GetTypeId() const {
49
0
  return variant_.Visit([](const auto& alternative) -> NativeTypeId {
50
0
    return NativeTypeId::Of(alternative);
51
0
  });
Unexecuted instantiation: map_value.cc:cel::TypeInfo cel::MapValue::GetTypeId() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: map_value.cc:cel::TypeInfo cel::MapValue::GetTypeId() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:cel::TypeInfo cel::MapValue::GetTypeId() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: map_value.cc:cel::TypeInfo cel::MapValue::GetTypeId() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
52
0
}
53
54
0
std::string MapValue::DebugString() const {
55
0
  return variant_.Visit([](const auto& alternative) -> std::string {
56
0
    return alternative.DebugString();
57
0
  });
Unexecuted instantiation: map_value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::MapValue::DebugString() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: map_value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::MapValue::DebugString() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::MapValue::DebugString() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: map_value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::MapValue::DebugString() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
58
0
}
59
60
absl::Status MapValue::SerializeTo(
61
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
62
    google::protobuf::MessageFactory* absl_nonnull message_factory,
63
0
    google::protobuf::io::ZeroCopyOutputStream* absl_nonnull output) const {
64
0
  ABSL_DCHECK(descriptor_pool != nullptr);
65
0
  ABSL_DCHECK(message_factory != nullptr);
66
0
  ABSL_DCHECK(output != nullptr);
67
68
0
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
69
0
    return alternative.SerializeTo(descriptor_pool, message_factory, output);
70
0
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
71
0
}
72
73
absl::Status MapValue::ConvertToJson(
74
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
75
    google::protobuf::MessageFactory* absl_nonnull message_factory,
76
0
    google::protobuf::Message* absl_nonnull json) const {
77
0
  ABSL_DCHECK(descriptor_pool != nullptr);
78
0
  ABSL_DCHECK(message_factory != nullptr);
79
0
  ABSL_DCHECK(json != nullptr);
80
0
  ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
81
0
                 google::protobuf::Descriptor::WELLKNOWNTYPE_VALUE);
82
83
0
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
84
0
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
85
0
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
86
0
}
87
88
absl::Status MapValue::ConvertToJsonObject(
89
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
90
    google::protobuf::MessageFactory* absl_nonnull message_factory,
91
0
    google::protobuf::Message* absl_nonnull json) const {
92
0
  ABSL_DCHECK(descriptor_pool != nullptr);
93
0
  ABSL_DCHECK(message_factory != nullptr);
94
0
  ABSL_DCHECK(json != nullptr);
95
0
  ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
96
0
                 google::protobuf::Descriptor::WELLKNOWNTYPE_STRUCT);
97
98
0
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
99
0
    return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
100
0
                                           json);
101
0
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
102
0
}
103
104
absl::Status MapValue::Equal(
105
    const Value& other,
106
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
107
    google::protobuf::MessageFactory* absl_nonnull message_factory,
108
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
109
0
  ABSL_DCHECK(descriptor_pool != nullptr);
110
0
  ABSL_DCHECK(message_factory != nullptr);
111
0
  ABSL_DCHECK(arena != nullptr);
112
0
  ABSL_DCHECK(result != nullptr);
113
114
0
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
115
0
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
116
0
                             result);
117
0
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
118
0
}
119
120
0
bool MapValue::IsZeroValue() const {
121
0
  return variant_.Visit([](const auto& alternative) -> bool {
122
0
    return alternative.IsZeroValue();
123
0
  });
Unexecuted instantiation: map_value.cc:bool cel::MapValue::IsZeroValue() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: map_value.cc:bool cel::MapValue::IsZeroValue() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:bool cel::MapValue::IsZeroValue() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: map_value.cc:bool cel::MapValue::IsZeroValue() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
124
0
}
125
126
0
absl::StatusOr<bool> MapValue::IsEmpty() const {
127
0
  return variant_.Visit([](const auto& alternative) -> absl::StatusOr<bool> {
128
0
    return alternative.IsEmpty();
129
0
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::StatusOr<bool> cel::MapValue::IsEmpty() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::StatusOr<bool> cel::MapValue::IsEmpty() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::StatusOr<bool> cel::MapValue::IsEmpty() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::StatusOr<bool> cel::MapValue::IsEmpty() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
130
0
}
131
132
3.39k
absl::StatusOr<size_t> MapValue::Size() const {
133
3.39k
  return variant_.Visit([](const auto& alternative) -> absl::StatusOr<size_t> {
134
3.39k
    return alternative.Size();
135
3.39k
  });
map_value.cc:absl::lts_20260526::StatusOr<unsigned long> cel::MapValue::Size() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Line
Count
Source
133
3.38k
  return variant_.Visit([](const auto& alternative) -> absl::StatusOr<size_t> {
134
3.38k
    return alternative.Size();
135
3.38k
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::StatusOr<unsigned long> cel::MapValue::Size() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::StatusOr<unsigned long> cel::MapValue::Size() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
map_value.cc:absl::lts_20260526::StatusOr<unsigned long> cel::MapValue::Size() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Line
Count
Source
133
3
  return variant_.Visit([](const auto& alternative) -> absl::StatusOr<size_t> {
134
3
    return alternative.Size();
135
3
  });
136
3.39k
}
137
138
absl::Status MapValue::Get(
139
    const Value& key,
140
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
141
    google::protobuf::MessageFactory* absl_nonnull message_factory,
142
121k
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
143
121k
  ABSL_DCHECK(descriptor_pool != nullptr);
144
121k
  ABSL_DCHECK(message_factory != nullptr);
145
121k
  ABSL_DCHECK(arena != nullptr);
146
121k
  ABSL_DCHECK(result != nullptr);
147
148
121k
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
149
121k
    return alternative.Get(key, descriptor_pool, message_factory, arena,
150
121k
                           result);
151
121k
  });
map_value.cc:absl::lts_20260526::Status cel::MapValue::Get(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Line
Count
Source
148
17.5k
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
149
17.5k
    return alternative.Get(key, descriptor_pool, message_factory, arena,
150
17.5k
                           result);
151
17.5k
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::Get(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::Get(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
map_value.cc:absl::lts_20260526::Status cel::MapValue::Get(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Line
Count
Source
148
104k
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
149
104k
    return alternative.Get(key, descriptor_pool, message_factory, arena,
150
104k
                           result);
151
104k
  });
152
121k
}
153
154
absl::StatusOr<bool> MapValue::Find(
155
    const Value& key,
156
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
157
    google::protobuf::MessageFactory* absl_nonnull message_factory,
158
110k
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
159
110k
  ABSL_DCHECK(descriptor_pool != nullptr);
160
110k
  ABSL_DCHECK(message_factory != nullptr);
161
110k
  ABSL_DCHECK(arena != nullptr);
162
110k
  ABSL_DCHECK(result != nullptr);
163
164
110k
  return variant_.Visit([&](const auto& alternative) -> absl::StatusOr<bool> {
165
110k
    return alternative.Find(key, descriptor_pool, message_factory, arena,
166
110k
                            result);
167
110k
  });
map_value.cc:absl::lts_20260526::StatusOr<bool> cel::MapValue::Find(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Line
Count
Source
164
17.2k
  return variant_.Visit([&](const auto& alternative) -> absl::StatusOr<bool> {
165
17.2k
    return alternative.Find(key, descriptor_pool, message_factory, arena,
166
17.2k
                            result);
167
17.2k
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::StatusOr<bool> cel::MapValue::Find(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::StatusOr<bool> cel::MapValue::Find(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
map_value.cc:absl::lts_20260526::StatusOr<bool> cel::MapValue::Find(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Line
Count
Source
164
93.2k
  return variant_.Visit([&](const auto& alternative) -> absl::StatusOr<bool> {
165
93.2k
    return alternative.Find(key, descriptor_pool, message_factory, arena,
166
93.2k
                            result);
167
93.2k
  });
168
110k
}
169
170
absl::Status MapValue::Has(
171
    const Value& key,
172
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
173
    google::protobuf::MessageFactory* absl_nonnull message_factory,
174
18.1k
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
175
18.1k
  ABSL_DCHECK(descriptor_pool != nullptr);
176
18.1k
  ABSL_DCHECK(message_factory != nullptr);
177
18.1k
  ABSL_DCHECK(arena != nullptr);
178
18.1k
  ABSL_DCHECK(result != nullptr);
179
180
18.1k
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
181
18.1k
    return alternative.Has(key, descriptor_pool, message_factory, arena,
182
18.1k
                           result);
183
18.1k
  });
map_value.cc:absl::lts_20260526::Status cel::MapValue::Has(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Line
Count
Source
180
17.1k
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
181
17.1k
    return alternative.Has(key, descriptor_pool, message_factory, arena,
182
17.1k
                           result);
183
17.1k
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::Has(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::Has(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
map_value.cc:absl::lts_20260526::Status cel::MapValue::Has(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Line
Count
Source
180
950
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
181
950
    return alternative.Has(key, descriptor_pool, message_factory, arena,
182
950
                           result);
183
950
  });
184
18.1k
}
185
186
absl::Status MapValue::ListKeys(
187
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
188
    google::protobuf::MessageFactory* absl_nonnull message_factory,
189
0
    google::protobuf::Arena* absl_nonnull arena, ListValue* absl_nonnull result) const {
190
0
  ABSL_DCHECK(descriptor_pool != nullptr);
191
0
  ABSL_DCHECK(message_factory != nullptr);
192
0
  ABSL_DCHECK(arena != nullptr);
193
0
  ABSL_DCHECK(result != nullptr);
194
195
0
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
196
0
    return alternative.ListKeys(descriptor_pool, message_factory, arena,
197
0
                                result);
198
0
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ListKeys(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::ListValue*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ListKeys(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::ListValue*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ListKeys(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::ListValue*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ListKeys(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::ListValue*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
199
0
}
200
201
absl::Status MapValue::ForEach(
202
    ForEachCallback callback,
203
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
204
    google::protobuf::MessageFactory* absl_nonnull message_factory,
205
0
    google::protobuf::Arena* absl_nonnull arena) const {
206
0
  ABSL_DCHECK(descriptor_pool != nullptr);
207
0
  ABSL_DCHECK(message_factory != nullptr);
208
0
  ABSL_DCHECK(arena != nullptr);
209
210
0
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
211
0
    return alternative.ForEach(callback, descriptor_pool, message_factory,
212
0
                               arena);
213
0
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ForEach(absl::lts_20260526::FunctionRef<absl::lts_20260526::StatusOr<bool> (cel::Value const&, cel::Value const&)>, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ForEach(absl::lts_20260526::FunctionRef<absl::lts_20260526::StatusOr<bool> (cel::Value const&, cel::Value const&)>, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ForEach(absl::lts_20260526::FunctionRef<absl::lts_20260526::StatusOr<bool> (cel::Value const&, cel::Value const&)>, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::Status cel::MapValue::ForEach(absl::lts_20260526::FunctionRef<absl::lts_20260526::StatusOr<bool> (cel::Value const&, cel::Value const&)>, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
214
0
}
215
216
2.61k
absl::StatusOr<absl_nonnull ValueIteratorPtr> MapValue::NewIterator() const {
217
2.61k
  return variant_.Visit([](const auto& alternative)
218
2.61k
                            -> absl::StatusOr<absl_nonnull ValueIteratorPtr> {
219
2.61k
    return alternative.NewIterator();
220
2.61k
  });
map_value.cc:absl::lts_20260526::StatusOr<std::__1::unique_ptr<cel::ValueIterator, std::__1::default_delete<cel::ValueIterator> > > cel::MapValue::NewIterator() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Line
Count
Source
218
2.41k
                            -> absl::StatusOr<absl_nonnull ValueIteratorPtr> {
219
2.41k
    return alternative.NewIterator();
220
2.41k
  });
Unexecuted instantiation: map_value.cc:absl::lts_20260526::StatusOr<std::__1::unique_ptr<cel::ValueIterator, std::__1::default_delete<cel::ValueIterator> > > cel::MapValue::NewIterator() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:absl::lts_20260526::StatusOr<std::__1::unique_ptr<cel::ValueIterator, std::__1::default_delete<cel::ValueIterator> > > cel::MapValue::NewIterator() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
map_value.cc:absl::lts_20260526::StatusOr<std::__1::unique_ptr<cel::ValueIterator, std::__1::default_delete<cel::ValueIterator> > > cel::MapValue::NewIterator() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Line
Count
Source
218
200
                            -> absl::StatusOr<absl_nonnull ValueIteratorPtr> {
219
200
    return alternative.NewIterator();
220
200
  });
221
2.61k
}
222
223
namespace common_internal {
224
225
absl::Status MapValueEqual(
226
    const MapValue& lhs, const MapValue& rhs,
227
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
228
    google::protobuf::MessageFactory* absl_nonnull message_factory,
229
1
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
230
1
  ABSL_DCHECK(descriptor_pool != nullptr);
231
1
  ABSL_DCHECK(message_factory != nullptr);
232
1
  ABSL_DCHECK(arena != nullptr);
233
1
  ABSL_DCHECK(result != nullptr);
234
235
2
  CEL_ASSIGN_OR_RETURN(auto lhs_size, lhs.Size());
236
2
  CEL_ASSIGN_OR_RETURN(auto rhs_size, rhs.Size());
237
1
  if (lhs_size != rhs_size) {
238
0
    *result = FalseValue();
239
0
    return absl::OkStatus();
240
0
  }
241
2
  CEL_ASSIGN_OR_RETURN(auto lhs_iterator, lhs.NewIterator());
242
2
  Value lhs_key;
243
2
  Value lhs_value;
244
2
  Value rhs_value;
245
2
  for (size_t index = 0; index < lhs_size; ++index) {
246
0
    ABSL_CHECK(lhs_iterator->HasNext());  // Crash OK
247
0
    CEL_RETURN_IF_ERROR(
248
0
        lhs_iterator->Next(descriptor_pool, message_factory, arena, &lhs_key));
249
0
    bool rhs_value_found;
250
0
    CEL_ASSIGN_OR_RETURN(
251
0
        rhs_value_found,
252
0
        rhs.Find(lhs_key, descriptor_pool, message_factory, arena, &rhs_value));
253
0
    if (!rhs_value_found) {
254
0
      *result = FalseValue();
255
0
      return absl::OkStatus();
256
0
    }
257
0
    CEL_RETURN_IF_ERROR(
258
0
        lhs.Get(lhs_key, descriptor_pool, message_factory, arena, &lhs_value));
259
0
    CEL_RETURN_IF_ERROR(lhs_value.Equal(rhs_value, descriptor_pool,
260
0
                                        message_factory, arena, result));
261
0
    if (result->IsFalse()) {
262
0
      return absl::OkStatus();
263
0
    }
264
0
  }
265
1
  ABSL_DCHECK(!lhs_iterator->HasNext());
266
1
  *result = TrueValue();
267
1
  return absl::OkStatus();
268
1
}
269
270
absl::Status MapValueEqual(
271
    const CustomMapValueInterface& lhs, const MapValue& rhs,
272
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
273
    google::protobuf::MessageFactory* absl_nonnull message_factory,
274
114
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
275
114
  ABSL_DCHECK(descriptor_pool != nullptr);
276
114
  ABSL_DCHECK(message_factory != nullptr);
277
114
  ABSL_DCHECK(arena != nullptr);
278
114
  ABSL_DCHECK(result != nullptr);
279
280
114
  auto lhs_size = lhs.Size();
281
114
  CEL_ASSIGN_OR_RETURN(auto rhs_size, rhs.Size());
282
114
  if (lhs_size != rhs_size) {
283
0
    *result = FalseValue();
284
0
    return absl::OkStatus();
285
0
  }
286
228
  CEL_ASSIGN_OR_RETURN(auto lhs_iterator, lhs.NewIterator());
287
228
  Value lhs_key;
288
228
  Value lhs_value;
289
228
  Value rhs_value;
290
228
  for (size_t index = 0; index < lhs_size; ++index) {
291
0
    ABSL_CHECK(lhs_iterator->HasNext());  // Crash OK
292
0
    CEL_RETURN_IF_ERROR(
293
0
        lhs_iterator->Next(descriptor_pool, message_factory, arena, &lhs_key));
294
0
    bool rhs_value_found;
295
0
    CEL_ASSIGN_OR_RETURN(
296
0
        rhs_value_found,
297
0
        rhs.Find(lhs_key, descriptor_pool, message_factory, arena, &rhs_value));
298
0
    if (!rhs_value_found) {
299
0
      *result = FalseValue();
300
0
      return absl::OkStatus();
301
0
    }
302
0
    CEL_RETURN_IF_ERROR(
303
0
        CustomMapValue(&lhs, arena)
304
0
            .Get(lhs_key, descriptor_pool, message_factory, arena, &lhs_value));
305
0
    CEL_RETURN_IF_ERROR(lhs_value.Equal(rhs_value, descriptor_pool,
306
0
                                        message_factory, arena, result));
307
0
    if (result->IsFalse()) {
308
0
      return absl::OkStatus();
309
0
    }
310
0
  }
311
114
  ABSL_DCHECK(!lhs_iterator->HasNext());
312
114
  *result = TrueValue();
313
114
  return absl::OkStatus();
314
114
}
315
316
}  // namespace common_internal
317
318
93.4k
absl::Status CheckMapKey(const Value& key) {
319
93.4k
  switch (key.kind()) {
320
8.32k
    case ValueKind::kBool:
321
8.32k
      ABSL_FALLTHROUGH_INTENDED;
322
66.7k
    case ValueKind::kInt:
323
66.7k
      ABSL_FALLTHROUGH_INTENDED;
324
70.6k
    case ValueKind::kUint:
325
70.6k
      ABSL_FALLTHROUGH_INTENDED;
326
93.0k
    case ValueKind::kString:
327
93.0k
      return absl::OkStatus();
328
0
    case ValueKind::kError:
329
0
      return key.GetError().NativeValue();
330
349
    default:
331
349
      return InvalidMapKeyTypeError(key.kind());
332
93.4k
  }
333
93.4k
}
334
335
0
optional_ref<const CustomMapValue> MapValue::AsCustom() const& {
336
0
  if (const auto* alternative = variant_.As<CustomMapValue>();
337
0
      alternative != nullptr) {
338
0
    return *alternative;
339
0
  }
340
0
  return std::nullopt;
341
0
}
342
343
0
absl::optional<CustomMapValue> MapValue::AsCustom() && {
344
0
  if (auto* alternative = variant_.As<CustomMapValue>();
345
0
      alternative != nullptr) {
346
0
    return std::move(*alternative);
347
0
  }
348
0
  return std::nullopt;
349
0
}
350
351
0
const CustomMapValue& MapValue::GetCustom() const& {
352
0
  ABSL_DCHECK(IsCustom());
353
354
0
  return variant_.Get<CustomMapValue>();
355
0
}
356
357
0
CustomMapValue MapValue::GetCustom() && {
358
0
  ABSL_DCHECK(IsCustom());
359
360
0
  return std::move(variant_).Get<CustomMapValue>();
361
0
}
362
363
0
common_internal::ValueVariant MapValue::ToValueVariant() const& {
364
0
  return variant_.Visit(
365
0
      [](const auto& alternative) -> common_internal::ValueVariant {
366
0
        return common_internal::ValueVariant(alternative);
367
0
      });
Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() const &::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() const &::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() const &::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() const &::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
368
0
}
369
370
270k
common_internal::ValueVariant MapValue::ToValueVariant() && {
371
270k
  return std::move(variant_).Visit(
372
270k
      [](auto&& alternative) -> common_internal::ValueVariant {
373
        // NOLINTNEXTLINE(bugprone-move-forwarding-reference)
374
270k
        return common_internal::ValueVariant(std::move(alternative));
375
270k
      });
map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() &&::$_0::operator()<cel::CustomMapValue const&>(cel::CustomMapValue const&) const
Line
Count
Source
372
62.6k
      [](auto&& alternative) -> common_internal::ValueVariant {
373
        // NOLINTNEXTLINE(bugprone-move-forwarding-reference)
374
62.6k
        return common_internal::ValueVariant(std::move(alternative));
375
62.6k
      });
Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() &&::$_0::operator()<cel::ParsedMapFieldValue const&>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() &&::$_0::operator()<cel::ParsedJsonMapValue const&>(cel::ParsedJsonMapValue const&) const
map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() &&::$_0::operator()<cel::common_internal::LegacyMapValue const&>(cel::common_internal::LegacyMapValue const&) const
Line
Count
Source
372
207k
      [](auto&& alternative) -> common_internal::ValueVariant {
373
        // NOLINTNEXTLINE(bugprone-move-forwarding-reference)
374
207k
        return common_internal::ValueVariant(std::move(alternative));
375
207k
      });
376
270k
}
377
378
}  // namespace cel