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

Method PostVisitList

eval/compiler/flat_expr_builder.cc:1496–1541  ·  view source on GitHub ↗

CreateList node handler. Invoked after child nodes are processed.

Source from the content-addressed store, hash-verified

1494 // CreateList node handler.
1495 // Invoked after child nodes are processed.
1496 void PostVisitList(const cel::Expr& expr,
1497 const cel::ListExpr& list_expr) override {
1498 if (!progress_status_.ok()) {
1499 return;
1500 }
1501
1502 if (block_.has_value()) {
1503 BlockInfo& block = *block_;
1504 if (block.bindings == &expr) {
1505 // Do nothing, this is the cel.@block bindings list.
1506 return;
1507 }
1508 }
1509
1510 if (!comprehension_stack_.empty()) {
1511 const ComprehensionStackRecord& comprehension =
1512 comprehension_stack_.back();
1513 if (comprehension.is_optimizable_list_append) {
1514 if (&(comprehension.comprehension->accu_init()) == &expr) {
1515 if (PlanRecursiveProgram()) {
1516 SetRecursiveStep(CreateDirectMutableListStep(expr.id()), 1);
1517 return;
1518 }
1519 AddStep(CreateMutableListStep(expr.id()));
1520 return;
1521 }
1522 if (GetOptimizableListAppendOperand(comprehension.comprehension) ==
1523 &expr) {
1524 return;
1525 }
1526 }
1527 }
1528 if (absl::optional<int> depth = RecursionEligible(); depth.has_value()) {
1529 auto deps = ExtractRecursiveDependencies();
1530 if (deps.size() != list_expr.elements().size()) {
1531 SetProgressStatusError(absl::InternalError(
1532 "Unexpected number of plan elements for CreateList expr"));
1533 return;
1534 }
1535 auto step = CreateDirectListStep(
1536 std::move(deps), MakeOptionalIndicesSet(list_expr), expr.id());
1537 SetRecursiveStep(std::move(step), *depth + 1);
1538 return;
1539 }
1540 AddStep(CreateCreateListStep(list_expr, expr.id()));
1541 }
1542
1543 // CreateStruct node handler.
1544 // Invoked after child nodes are processed.

Callers

nothing calls this directly

Calls 11

CreateMutableListStepFunction · 0.85
CreateDirectListStepFunction · 0.85
CreateCreateListStepFunction · 0.85
MakeOptionalIndicesSetFunction · 0.70
okMethod · 0.45
has_valueMethod · 0.45
emptyMethod · 0.45
idMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected