| 1579 | } |
| 1580 | |
| 1581 | void PostVisitMap(const cel::Expr& expr, |
| 1582 | const cel::MapExpr& map_expr) override { |
| 1583 | for (const auto& entry : map_expr.entries()) { |
| 1584 | ValidateOrError(entry.has_key(), "Map entry missing key"); |
| 1585 | ValidateOrError(entry.has_value(), "Map entry missing value"); |
| 1586 | } |
| 1587 | |
| 1588 | if (!comprehension_stack_.empty()) { |
| 1589 | const ComprehensionStackRecord& comprehension = |
| 1590 | comprehension_stack_.back(); |
| 1591 | if (comprehension.is_optimizable_map_insert) { |
| 1592 | if (&(comprehension.comprehension->accu_init()) == &expr) { |
| 1593 | if (PlanRecursiveProgram()) { |
| 1594 | SetRecursiveStep(CreateDirectMutableMapStep(expr.id()), 1); |
| 1595 | return; |
| 1596 | } |
| 1597 | AddStep(CreateMutableMapStep(expr.id())); |
| 1598 | return; |
| 1599 | } |
| 1600 | } |
| 1601 | } |
| 1602 | |
| 1603 | if (auto depth = RecursionEligible(); depth.has_value()) { |
| 1604 | auto deps = ExtractRecursiveDependencies(); |
| 1605 | if (deps.size() != 2 * map_expr.entries().size()) { |
| 1606 | SetProgressStatusError(absl::InternalError( |
| 1607 | "Unexpected number of plan elements for CreateStruct expr")); |
| 1608 | return; |
| 1609 | } |
| 1610 | auto step = CreateDirectCreateMapStep( |
| 1611 | std::move(deps), MakeOptionalIndicesSet(map_expr), expr.id()); |
| 1612 | SetRecursiveStep(std::move(step), *depth + 1); |
| 1613 | return; |
| 1614 | } |
| 1615 | AddStep(CreateCreateStructStepForMap(map_expr.entries().size(), |
| 1616 | MakeOptionalIndicesSet(map_expr), |
| 1617 | expr.id())); |
| 1618 | } |
| 1619 | |
| 1620 | absl::Status progress_status() const { return progress_status_; } |
| 1621 |
nothing calls this directly
no test coverage detected