Skip to content

Commit 42c7d1b

Browse files
authored
Merge pull request #163 from google/cpp-sync
OSS sync.
2 parents 11f9d66 + 14d3808 commit 42c7d1b

File tree

150 files changed

+8863
-2210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+8863
-2210
lines changed

base/BUILD

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,28 @@ package(
1919

2020
licenses(["notice"])
2121

22+
cc_library(
23+
name = "attributes",
24+
srcs = [
25+
"attribute.cc",
26+
],
27+
hdrs = [
28+
"attribute.h",
29+
"attribute_set.h",
30+
],
31+
deps = [
32+
":kind",
33+
"//internal:status_macros",
34+
"@com_google_absl//absl/container:btree",
35+
"@com_google_absl//absl/status:statusor",
36+
"@com_google_absl//absl/strings",
37+
"@com_google_absl//absl/types:optional",
38+
"@com_google_absl//absl/types:span",
39+
"@com_google_absl//absl/types:variant",
40+
"@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto",
41+
],
42+
)
43+
2244
cc_library(
2345
name = "handle",
2446
hdrs = ["handle.h"],
@@ -127,6 +149,7 @@ cc_library(
127149
"@com_google_absl//absl/base",
128150
"@com_google_absl//absl/base:core_headers",
129151
"@com_google_absl//absl/hash",
152+
"@com_google_absl//absl/status",
130153
"@com_google_absl//absl/status:statusor",
131154
"@com_google_absl//absl/strings",
132155
"@com_google_absl//absl/types:variant",
@@ -204,7 +227,6 @@ cc_test(
204227
":value",
205228
"//base/internal:memory_manager_testing",
206229
"//internal:testing",
207-
"@com_google_absl//absl/hash",
208230
"@com_google_absl//absl/hash:hash_testing",
209231
"@com_google_absl//absl/status",
210232
],
@@ -219,10 +241,13 @@ cc_library(
219241
"value.h",
220242
] + glob(["values/*.h"]),
221243
deps = [
244+
":attributes",
245+
":functions",
222246
":handle",
223247
":kind",
224248
":type",
225249
"//base/internal:data",
250+
"//base/internal:unknown_set",
226251
"//base/internal:value",
227252
"//internal:casts",
228253
"//internal:rtti",
@@ -248,6 +273,8 @@ cc_library(
248273
srcs = ["value_factory.cc"],
249274
hdrs = ["value_factory.h"],
250275
deps = [
276+
":attributes",
277+
":functions",
251278
":handle",
252279
":memory_manager",
253280
":type_manager",
@@ -297,8 +324,10 @@ cc_library(
297324
"ast.h",
298325
],
299326
deps = [
300-
"@com_google_absl//absl/base:core_headers",
301327
"@com_google_absl//absl/container:flat_hash_map",
328+
"@com_google_absl//absl/log",
329+
"@com_google_absl//absl/strings",
330+
"@com_google_absl//absl/strings:str_format",
302331
"@com_google_absl//absl/time",
303332
"@com_google_absl//absl/types:variant",
304333
],
@@ -312,8 +341,7 @@ cc_test(
312341
deps = [
313342
":ast",
314343
"//internal:testing",
315-
"@com_google_absl//absl/memory",
316-
"@com_google_absl//absl/types:variant",
344+
"@com_google_absl//absl/time",
317345
],
318346
)
319347

@@ -323,17 +351,37 @@ cc_library(
323351
hdrs = ["ast_utility.h"],
324352
deps = [
325353
":ast",
354+
"//internal:status_macros",
326355
"@com_google_absl//absl/container:flat_hash_map",
327356
"@com_google_absl//absl/memory",
328357
"@com_google_absl//absl/status",
329358
"@com_google_absl//absl/status:statusor",
330359
"@com_google_absl//absl/time",
360+
"@com_google_absl//absl/types:variant",
331361
"@com_google_googleapis//google/api/expr/v1alpha1:checked_cc_proto",
332362
"@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto",
333363
"@com_google_protobuf//:protobuf",
334364
],
335365
)
336366

367+
cc_library(
368+
name = "functions",
369+
srcs = [
370+
"function.cc",
371+
"function_result_set.cc",
372+
],
373+
hdrs = [
374+
"function.h",
375+
"function_result.h",
376+
"function_result_set.h",
377+
],
378+
deps = [
379+
":kind",
380+
"@com_google_absl//absl/container:btree",
381+
"@com_google_absl//absl/types:span",
382+
],
383+
)
384+
337385
cc_test(
338386
name = "ast_utility_test",
339387
srcs = [

base/ast.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414

1515
#include "base/ast.h"
1616

17+
#include <cstdint>
1718
#include <memory>
19+
#include <string>
20+
#include <utility>
21+
#include <vector>
1822

1923
namespace cel::ast::internal {
2024

@@ -65,8 +69,13 @@ const Expr& CreateStruct::Entry::value() const {
6569
}
6670

6771
bool CreateStruct::Entry::operator==(const Entry& other) const {
68-
return id_ == other.id_ && key_kind_ == other.key_kind_ &&
69-
value() == other.value();
72+
bool has_same_key = false;
73+
if (has_field_key() && other.has_field_key()) {
74+
has_same_key = field_key() == other.field_key();
75+
} else if (has_map_key() && other.has_map_key()) {
76+
has_same_key = map_key() == other.map_key();
77+
}
78+
return id_ == other.id_ && has_same_key && value() == other.value();
7079
}
7180

7281
const Expr& Comprehension::iter_range() const {

0 commit comments

Comments
 (0)