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

Method PostVisitSelect

eval/compiler/flat_expr_builder.cc:948–986  ·  view source on GitHub ↗

Select node handler. Invoked after child nodes are processed.

Source from the content-addressed store, hash-verified

946 // Select node handler.
947 // Invoked after child nodes are processed.
948 void PostVisitSelect(const cel::Expr& expr,
949 const cel::SelectExpr& select_expr) override {
950 if (!progress_status_.ok()) {
951 return;
952 }
953
954 // Check if we are "in the middle" of namespaced name.
955 // This is currently enum specific. Constant expression that corresponds
956 // to resolved enum value has been already created, thus preceding chain
957 // of selects is no longer relevant.
958 if (resolved_select_expr_) {
959 if (&expr == resolved_select_expr_) {
960 resolved_select_expr_ = nullptr;
961 }
962 return;
963 }
964
965 if (auto depth = RecursionEligible(); depth.has_value()) {
966 auto deps = ExtractRecursiveDependencies();
967 if (deps.size() != 1) {
968 SetProgressStatusError(absl::InternalError(
969 "unexpected number of dependencies for select operation."));
970 return;
971 }
972 StringValue field = cel::StringValue(select_expr.field());
973
974 SetRecursiveStep(
975 CreateDirectSelectStep(std::move(deps[0]), std::move(field),
976 select_expr.test_only(), expr.id(),
977 options_.enable_empty_wrapper_null_unboxing,
978 enable_optional_types_),
979 *depth + 1);
980 return;
981 }
982
983 AddStep(CreateSelectStep(select_expr, expr.id(),
984 options_.enable_empty_wrapper_null_unboxing,
985 enable_optional_types_));
986 }
987
988 // Call node handler group.
989 // We provide finer granularity for Call node callbacks to allow special

Callers

nothing calls this directly

Calls 9

CreateDirectSelectStepFunction · 0.85
CreateSelectStepFunction · 0.85
test_onlyMethod · 0.80
StringValueClass · 0.50
okMethod · 0.45
has_valueMethod · 0.45
sizeMethod · 0.45
fieldMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected