| 2193 | } |
| 2194 | |
| 2195 | void 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 | |
| 2225 | void BinaryCondVisitor::PostVisit(const cel::Expr* expr) { |
| 2226 | if (visitor_->PlanRecursiveProgram()) { |
no test coverage detected