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

Function ExpandHasMacro

parser/macro.cc:65–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65absl::optional<Expr> ExpandHasMacro(MacroExprFactory& factory,
66 absl::Span<Expr> args) {
67 if (args.size() != 1) {
68 return factory.ReportError("has() requires 1 arguments");
69 }
70 if (!args[0].has_select_expr() || args[0].select_expr().test_only()) {
71 return factory.ReportErrorAt(args[0],
72 "has() argument must be a field selection");
73 }
74 return factory.NewPresenceTest(
75 args[0].mutable_select_expr().release_operand(),
76 args[0].mutable_select_expr().release_field());
77}
78
79Macro MakeHasMacro() {
80 auto macro_or_status = Macro::Global(CelOperator::HAS, 1, ExpandHasMacro);

Callers

nothing calls this directly

Calls 7

has_select_exprMethod · 0.80
test_onlyMethod · 0.80
release_operandMethod · 0.80
sizeMethod · 0.45
ReportErrorMethod · 0.45
ReportErrorAtMethod · 0.45
NewPresenceTestMethod · 0.45

Tested by

no test coverage detected