| 99 | } |
| 100 | |
| 101 | absl::optional<int> Subexpression::RecursiveDependencyDepth() const { |
| 102 | auto* tree = absl::get_if<TreePlan>(&program_); |
| 103 | int depth = 0; |
| 104 | if (tree == nullptr) { |
| 105 | return absl::nullopt; |
| 106 | } |
| 107 | for (const auto& element : *tree) { |
| 108 | auto* subexpression = absl::get_if<Subexpression*>(&element); |
| 109 | if (subexpression == nullptr) { |
| 110 | return absl::nullopt; |
| 111 | } |
| 112 | if (!(*subexpression)->IsRecursive()) { |
| 113 | return absl::nullopt; |
| 114 | } |
| 115 | depth = std::max(depth, (*subexpression)->recursive_program().depth); |
| 116 | } |
| 117 | return depth; |
| 118 | } |
| 119 | |
| 120 | std::vector<std::unique_ptr<DirectExpressionStep>> |
| 121 | Subexpression::ExtractRecursiveDependencies() const { |