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

Method PostVisitTarget

eval/compiler/flat_expr_builder.cc:2195–2223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2193}
2194
2195void BinaryCondVisitor::PostVisitTarget(const cel::Expr* expr) {
2196 if (visitor_->PlanRecursiveProgram()) {
2197 return;
2198 }
2199 if (short_circuiting_ && (cond_ == BinaryCond::kOptionalOr ||
2200 cond_ == BinaryCond::kOptionalOrValue)) {
2201 // If first branch evaluation result is enough to determine output,
2202 // jump over the second branch and provide result of the first argument as
2203 // final output.
2204 // Retain a pointer to the jump step so we can update the target after
2205 // planning the second argument.
2206 std::unique_ptr<JumpStepBase> jump_step;
2207 switch (cond_) {
2208 case BinaryCond::kOptionalOr:
2209 jump_step = CreateOptionalHasValueJumpStep(false, expr->id());
2210 break;
2211 case BinaryCond::kOptionalOrValue:
2212 jump_step = CreateOptionalHasValueJumpStep(true, expr->id());
2213 break;
2214 default:
2215 ABSL_UNREACHABLE();
2216 }
2217 ProgramStepIndex index = visitor_->GetCurrentIndex();
2218 if (JumpStepBase* jump_step_ptr = visitor_->AddStep(std::move(jump_step));
2219 jump_step_ptr) {
2220 jump_step_ = Jump(index, jump_step_ptr);
2221 }
2222 }
2223}
2224
2225void BinaryCondVisitor::PostVisit(const cel::Expr* expr) {
2226 if (visitor_->PlanRecursiveProgram()) {

Callers 1

PostVisitTargetMethod · 0.45

Calls 6

JumpClass · 0.85
PlanRecursiveProgramMethod · 0.80
GetCurrentIndexMethod · 0.80
idMethod · 0.45
AddStepMethod · 0.45

Tested by

no test coverage detected