| 136 | } |
| 137 | |
| 138 | void flattenTopLevelConjuncts( |
| 139 | const core::TypedExprPtr& expr, |
| 140 | std::vector<core::TypedExprPtr>& conjuncts) { |
| 141 | std::vector<core::TypedExprPtr> pending; |
| 142 | if (expr) { |
| 143 | pending.push_back(expr); |
| 144 | } |
| 145 | |
| 146 | while (!pending.empty()) { |
| 147 | auto current = std::move(pending.back()); |
| 148 | pending.pop_back(); |
| 149 | if (!current) { |
| 150 | continue; |
| 151 | } |
| 152 | auto call = std::dynamic_pointer_cast<const core::CallTypedExpr>(current); |
| 153 | if (call && call->name() == "and") { |
| 154 | const auto& inputs = call->inputs(); |
| 155 | for (size_t i = inputs.size(); i > 0; --i) { |
| 156 | pending.push_back(inputs[i - 1]); |
| 157 | } |
| 158 | continue; |
| 159 | } |
| 160 | conjuncts.push_back(std::move(current)); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | std::vector<core::TypedExprPtr> flattenTopLevelConjuncts( |
| 165 | const core::TypedExprPtr& expr) { |