| 124 | } |
| 125 | |
| 126 | std::optional<std::string> shouldFlatten( |
| 127 | const TypedExprPtr& expr, |
| 128 | const std::unordered_set<std::string>& flatteningCandidates) { |
| 129 | if (auto call = std::dynamic_pointer_cast<const core::CallTypedExpr>(expr)) { |
| 130 | // Currently only supports the most common case for flattening where all |
| 131 | // inputs are of the same type. |
| 132 | if (call->name() == kAnd || call->name() == kOr || |
| 133 | (flatteningCandidates.count(call->name()) && |
| 134 | allInputTypesEquivalent(expr))) { |
| 135 | return call->name(); |
| 136 | } |
| 137 | } |
| 138 | return std::nullopt; |
| 139 | } |
| 140 | |
| 141 | bool isCall(const TypedExprPtr& expr, const std::string& name) { |
| 142 | if (auto call = std::dynamic_pointer_cast<const core::CallTypedExpr>(expr)) { |
no test coverage detected