|
17 | 17 | #ifndef THIRD_PARTY_CEL_CPP_BASE_AST_INTERNAL_EXPR_H_ |
18 | 18 | #define THIRD_PARTY_CEL_CPP_BASE_AST_INTERNAL_EXPR_H_ |
19 | 19 |
|
20 | | -#include <cstddef> |
21 | 20 | #include <cstdint> |
22 | 21 | #include <memory> |
23 | 22 | #include <string> |
|
33 | 32 |
|
34 | 33 | namespace cel::ast_internal { |
35 | 34 |
|
36 | | -// Temporary aliases that will be deleted in future. |
37 | | -using NullValue = std::nullptr_t; |
38 | | -using Bytes = cel::BytesConstant; |
39 | | -using Constant = cel::Constant; |
40 | | -using ConstantKind = cel::ConstantKind; |
41 | | -using Ident = cel::IdentExpr; |
42 | | -using Expr = cel::Expr; |
43 | | -using ExprKind = cel::ExprKind; |
44 | | -using Select = cel::SelectExpr; |
45 | | -using Call = cel::CallExpr; |
46 | | -using CreateList = cel::ListExpr; |
47 | | -using CreateStruct = cel::StructExpr; |
48 | | -using Comprehension = cel::ComprehensionExpr; |
49 | 35 |
|
50 | 36 | // An extension that was requested for the source expression. |
51 | 37 | class Extension { |
@@ -566,10 +552,17 @@ enum class ErrorType { kErrorTypeValue = 0 }; |
566 | 552 |
|
567 | 553 | struct UnspecifiedType : public absl::monostate {}; |
568 | 554 |
|
569 | | -struct DynamicType : public absl::monostate {}; |
| 555 | +struct DynamicType {}; |
| 556 | + |
| 557 | +inline bool operator==(const DynamicType&, const DynamicType&) { return true; } |
| 558 | +inline bool operator!=(const DynamicType&, const DynamicType&) { return false; } |
| 559 | + |
| 560 | +struct NullType {}; |
| 561 | +inline bool operator==(const NullType&, const NullType&) { return true; } |
| 562 | +inline bool operator!=(const NullType&, const NullType&) { return false; } |
570 | 563 |
|
571 | 564 | using TypeKind = |
572 | | - absl::variant<UnspecifiedType, DynamicType, NullValue, PrimitiveType, |
| 565 | + absl::variant<UnspecifiedType, DynamicType, NullType, PrimitiveType, |
573 | 566 | PrimitiveTypeWrapper, WellKnownType, ListType, MapType, |
574 | 567 | FunctionType, MessageType, ParamType, |
575 | 568 | absl_nullable std::unique_ptr<Type>, ErrorType, AbstractType>; |
@@ -599,7 +592,7 @@ class Type { |
599 | 592 | } |
600 | 593 |
|
601 | 594 | bool has_null() const { |
602 | | - return absl::holds_alternative<NullValue>(type_kind_); |
| 595 | + return absl::holds_alternative<NullType>(type_kind_); |
603 | 596 | } |
604 | 597 |
|
605 | 598 | bool has_primitive() const { |
@@ -646,12 +639,12 @@ class Type { |
646 | 639 | return absl::holds_alternative<AbstractType>(type_kind_); |
647 | 640 | } |
648 | 641 |
|
649 | | - NullValue null() const { |
650 | | - auto* value = absl::get_if<NullValue>(&type_kind_); |
| 642 | + NullType null() const { |
| 643 | + auto* value = absl::get_if<NullType>(&type_kind_); |
651 | 644 | if (value != nullptr) { |
652 | 645 | return *value; |
653 | 646 | } |
654 | | - return nullptr; |
| 647 | + return {}; |
655 | 648 | } |
656 | 649 |
|
657 | 650 | PrimitiveType primitive() const { |
|
0 commit comments