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

Method VisitCall

tools/cel_unparser.cc:249–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249absl::Status Unparser::VisitCall(const Expr::Call& expr) {
250 const auto& fun = expr.function();
251 absl::optional<std::string> op = LookupUnaryOperator(fun);
252 if (op.has_value()) {
253 return VisitUnary(expr, *op);
254 }
255
256 op = LookupBinaryOperator(fun);
257 if (op.has_value()) {
258 return VisitBinary(expr, *op);
259 }
260
261 if (fun == CelOperator::INDEX) {
262 return VisitIndex(expr);
263 }
264
265 if (fun == CelOperator::OPT_INDEX) {
266 return VisitOptIndex(expr);
267 }
268
269 if (fun == CelOperator::OPT_SELECT) {
270 return VisitOptSelect(expr);
271 }
272
273 if (fun == CelOperator::CONDITIONAL) {
274 return VisitTernary(expr);
275 }
276
277 if (expr.has_target()) {
278 bool nested = IsBinaryOrTernaryOperator(expr.target());
279 CEL_RETURN_IF_ERROR(VisitMaybeNested(expr.target(), nested));
280 Print(kDot);
281 }
282 Print(fun, kLeftParen);
283 for (int i = 0; i < expr.args_size(); i++) {
284 if (i > 0) {
285 Print(kComma, kSpace);
286 }
287 CEL_RETURN_IF_ERROR(Visit(expr.args(i)));
288 }
289 Print(kRightParen);
290 return absl::OkStatus();
291}
292
293absl::Status Unparser::VisitCreateList(const Expr::CreateList& expr) {
294 Print(kLeftBracket);

Callers

nothing calls this directly

Calls 6

LookupUnaryOperatorFunction · 0.85
LookupBinaryOperatorFunction · 0.85
has_targetMethod · 0.80
argsMethod · 0.80
VisitFunction · 0.50
has_valueMethod · 0.45

Tested by

no test coverage detected