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

Method Invoke

eval/public/cel_function.cc:53–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53absl::StatusOr<Value> CelFunction::Invoke(
54 absl::Span<const cel::Value> arguments,
55 const cel::Function::InvokeContext& context) const {
56 std::vector<CelValue> legacy_args;
57 legacy_args.reserve(arguments.size());
58
59 // Users shouldn't be able to create expressions that call registered
60 // functions with unconvertible types, but it's possible to create an AST that
61 // can trigger this by making an unexpected call on a value that the
62 // interpreter expects to only be used with internal program steps.
63 for (const auto& arg : arguments) {
64 CEL_ASSIGN_OR_RETURN(legacy_args.emplace_back(),
65 ToLegacyValue(context.arena(), arg, true));
66 }
67
68 CelValue legacy_result;
69
70 CEL_RETURN_IF_ERROR(Evaluate(legacy_args, &legacy_result, context.arena()));
71
72 return cel::interop_internal::LegacyValueToModernValueOrDie(
73 context.arena(), legacy_result, /*unchecked=*/true);
74}
75
76} // namespace google::api::expr::runtime

Callers

nothing calls this directly

Calls 6

ToLegacyValueFunction · 0.85
EvaluateFunction · 0.85
CEL_ASSIGN_OR_RETURNFunction · 0.50
sizeMethod · 0.45
arenaMethod · 0.45

Tested by

no test coverage detected