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

Method PostVisit

eval/compiler/flat_expr_builder.cc:2225–2271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2223}
2224
2225void BinaryCondVisitor::PostVisit(const cel::Expr* expr) {
2226 if (visitor_->PlanRecursiveProgram()) {
2227 switch (cond_) {
2228 case BinaryCond::kAnd:
2229 visitor_->MakeShortcircuitRecursive(expr, /*is_or=*/false);
2230 break;
2231 case BinaryCond::kOr:
2232 visitor_->MakeShortcircuitRecursive(expr, /*is_or=*/true);
2233 break;
2234 case BinaryCond::kOptionalOr:
2235 visitor_->MakeOptionalShortcircuit(expr,
2236 /*is_or_value=*/false);
2237 break;
2238 case BinaryCond::kOptionalOrValue:
2239 visitor_->MakeOptionalShortcircuit(expr,
2240 /*is_or_value=*/true);
2241 break;
2242 default:
2243 ABSL_UNREACHABLE();
2244 }
2245 return;
2246 }
2247
2248 switch (cond_) {
2249 case BinaryCond::kAnd:
2250 visitor_->AddStep(CreateAndStep(expr->id()));
2251 break;
2252 case BinaryCond::kOr:
2253 visitor_->AddStep(CreateOrStep(expr->id()));
2254 break;
2255 case BinaryCond::kOptionalOr:
2256 visitor_->AddStep(
2257 CreateOptionalOrStep(/*is_or_value=*/false, expr->id()));
2258 break;
2259 case BinaryCond::kOptionalOrValue:
2260 visitor_->AddStep(CreateOptionalOrStep(/*is_or_value=*/true, expr->id()));
2261 break;
2262 default:
2263 ABSL_UNREACHABLE();
2264 }
2265 if (short_circuiting_) {
2266 // If short-circuiting is enabled, point the conditional jump past the
2267 // boolean operator step.
2268 visitor_->SetProgressStatusError(
2269 jump_step_.set_target(visitor_->GetCurrentIndex()));
2270 }
2271}
2272
2273void TernaryCondVisitor::PreVisit(const cel::Expr* expr) {
2274 visitor_->ValidateOrError(

Callers 2

PostVisitCallMethod · 0.80

Calls 15

CreateAndStepFunction · 0.85
CreateOrStepFunction · 0.85
CreateOptionalOrStepFunction · 0.85
CreateTernaryStepFunction · 0.85
PlanRecursiveProgramMethod · 0.80
GetCurrentIndexMethod · 0.80
MakeTernaryRecursiveMethod · 0.80
ValidateOrErrorMethod · 0.80
existsMethod · 0.80

Tested by

no test coverage detected