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

Method HandleIndex

eval/compiler/flat_expr_builder.cc:1939–1967  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1937};
1938
1939FlatExprVisitor::CallHandlerResult FlatExprVisitor::HandleIndex(
1940 const cel::Expr& expr, const cel::CallExpr& call_expr) {
1941 ABSL_DCHECK(call_expr.function() == cel::builtin::kIndex);
1942 if (!ValidateOrError(
1943 (call_expr.args().size() == 2 && !call_expr.has_target()) ||
1944 // TODO(uncreated-issue/79): A few clients use the index operator with a
1945 // target in custom ASTs.
1946 (call_expr.args().size() == 1 && call_expr.has_target()),
1947 "unexpected number of args for builtin index operator")) {
1948 return CallHandlerResult::kIntercepted;
1949 }
1950
1951 if (auto depth = RecursionEligible(); depth.has_value()) {
1952 auto args = ExtractRecursiveDependencies();
1953 if (args.size() != 2) {
1954 SetProgressStatusError(absl::InvalidArgumentError(
1955 "unexpected number of args for builtin index operator"));
1956 return CallHandlerResult::kIntercepted;
1957 }
1958 SetRecursiveStep(
1959 CreateDirectContainerAccessStep(std::move(args[0]), std::move(args[1]),
1960 enable_optional_types_, expr.id()),
1961 *depth + 1);
1962 return CallHandlerResult::kIntercepted;
1963 }
1964 AddStep(
1965 CreateContainerAccessStep(call_expr, expr.id(), enable_optional_types_));
1966 return CallHandlerResult::kIntercepted;
1967}
1968
1969FlatExprVisitor::CallHandlerResult FlatExprVisitor::HandleNot(
1970 const cel::Expr& expr, const cel::CallExpr& call_expr) {

Callers

nothing calls this directly

Calls 7

argsMethod · 0.80
has_targetMethod · 0.80
sizeMethod · 0.45
has_valueMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected