| 499 | } |
| 500 | |
| 501 | absl::Status Unparser::VisitTernary(const Expr::Call& expr) { |
| 502 | if (expr.args_size() != 3) { |
| 503 | return absl::InvalidArgumentError( |
| 504 | absl::StrCat("Unexpected ternary: ", expr.ShortDebugString())); |
| 505 | } |
| 506 | |
| 507 | bool nested = |
| 508 | IsOperatorSamePrecedence(CelOperator::CONDITIONAL, expr.args(0)) || |
| 509 | IsComplexOperator(expr.args(0)); |
| 510 | CEL_RETURN_IF_ERROR(VisitMaybeNested(expr.args(0), nested)); |
| 511 | |
| 512 | Print(kSpace, kQuestionMark, kSpace); |
| 513 | |
| 514 | nested = IsOperatorSamePrecedence(CelOperator::CONDITIONAL, expr.args(1)) || |
| 515 | IsComplexOperator(expr.args(1)); |
| 516 | CEL_RETURN_IF_ERROR(VisitMaybeNested(expr.args(1), nested)); |
| 517 | |
| 518 | Print(kSpace, kColon, kSpace); |
| 519 | |
| 520 | nested = IsOperatorSamePrecedence(CelOperator::CONDITIONAL, expr.args(2)) || |
| 521 | IsComplexOperator(expr.args(2)); |
| 522 | return VisitMaybeNested(expr.args(2), nested); |
| 523 | } |
| 524 | |
| 525 | bool Unparser::IsComplexOperatorWithRespectTo(const Expr& expr, |
| 526 | const std::string& op) { |
nothing calls this directly
no test coverage detected