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

Method GetFunction

runtime/function_registry.cc:47–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 ActivationFunctionProviderImpl() = default;
46
47 absl::StatusOr<absl::optional<cel::FunctionOverloadReference>> GetFunction(
48 const cel::FunctionDescriptor& descriptor,
49 const cel::ActivationInterface& activation) const override {
50 std::vector<cel::FunctionOverloadReference> overloads =
51 activation.FindFunctionOverloads(descriptor.name());
52
53 absl::optional<cel::FunctionOverloadReference> matching_overload =
54 absl::nullopt;
55
56 for (const auto& overload : overloads) {
57 if (overload.descriptor.ShapeMatches(descriptor)) {
58 if (matching_overload.has_value()) {
59 return absl::Status(absl::StatusCode::kInvalidArgument,
60 "Couldn't resolve function.");
61 }
62 matching_overload.emplace(overload);
63 }
64 }
65
66 return matching_overload;
67 }
68};
69
70// Create a CelFunctionProvider that just looks up the functions inserted in the

Callers 1

TESTFunction · 0.45

Calls 4

FindFunctionOverloadsMethod · 0.45
nameMethod · 0.45
ShapeMatchesMethod · 0.45
has_valueMethod · 0.45

Tested by 1

TESTFunction · 0.36