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

Function ValidateExtensionIdentifier

extensions/proto_ext.cc:43–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41static constexpr char kHasExt[] = "hasExt";
42
43absl::optional<std::string> ValidateExtensionIdentifier(const Expr& expr) {
44 return absl::visit(
45 absl::Overload(
46 [](const SelectExpr& select_expr) -> absl::optional<std::string> {
47 if (select_expr.test_only()) {
48 return absl::nullopt;
49 }
50 auto op_name = ValidateExtensionIdentifier(select_expr.operand());
51 if (!op_name.has_value()) {
52 return absl::nullopt;
53 }
54 return absl::StrCat(*op_name, ".", select_expr.field());
55 },
56 [](const IdentExpr& ident_expr) -> absl::optional<std::string> {
57 return ident_expr.name();
58 },
59 [](const auto&) -> absl::optional<std::string> {
60 return absl::nullopt;
61 }),
62 expr.kind());
63}
64
65absl::optional<std::string> GetExtensionFieldName(const Expr& expr) {
66 if (const auto* select_expr =

Callers 1

GetExtensionFieldNameFunction · 0.85

Calls 5

test_onlyMethod · 0.80
has_valueMethod · 0.45
fieldMethod · 0.45
nameMethod · 0.45
kindMethod · 0.45

Tested by

no test coverage detected