MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / BalancedTree

Method BalancedTree

parser/parser.cc:586–604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584}
585
586Expr ExpressionBalancer::BalancedTree(int lo, int hi) {
587 int mid = (lo + hi + 1) / 2;
588
589 std::vector<Expr> arguments;
590 arguments.reserve(2);
591
592 if (mid == lo) {
593 arguments.push_back(std::move(terms_[mid]));
594 } else {
595 arguments.push_back(BalancedTree(lo, mid - 1));
596 }
597
598 if (mid == hi) {
599 arguments.push_back(std::move(terms_[mid + 1]));
600 } else {
601 arguments.push_back(BalancedTree(mid + 1, hi));
602 }
603 return factory_.NewCall(ops_[mid], function_, std::move(arguments));
604}
605
606class ParserVisitor final : public CelBaseVisitor,
607 public antlr4::BaseErrorListener {

Callers

nothing calls this directly

Calls 1

NewCallMethod · 0.45

Tested by

no test coverage detected