MCPcopy Create free account
hub / github.com/bytedance/bolt / shouldFlatten

Function shouldFlatten

bolt/expression/ExprCompiler.cpp:126–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126std::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
141bool isCall(const TypedExprPtr& expr, const std::string& name) {
142 if (auto call = std::dynamic_pointer_cast<const core::CallTypedExpr>(expr)) {

Callers 1

compileInputsFunction · 0.85

Calls 3

allInputTypesEquivalentFunction · 0.85
nameMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected