| 303 | } |
| 304 | |
| 305 | absl::StatusOr<ResolveResult> ResolveLazy( |
| 306 | absl::Span<const cel::Value> input_args, absl::string_view name, |
| 307 | bool receiver_style, |
| 308 | absl::Span<const cel::FunctionRegistry::LazyOverload> providers, |
| 309 | const ExecutionFrameBase& frame) { |
| 310 | ResolveResult result = absl::nullopt; |
| 311 | |
| 312 | std::vector<cel::Kind> arg_types(input_args.size()); |
| 313 | |
| 314 | std::transform( |
| 315 | input_args.begin(), input_args.end(), arg_types.begin(), |
| 316 | [](const cel::Value& value) { return ValueKindToKind(value->kind()); }); |
| 317 | |
| 318 | cel::FunctionDescriptor matcher{name, receiver_style, arg_types}; |
| 319 | |
| 320 | const cel::ActivationInterface& activation = frame.activation(); |
| 321 | for (auto provider : providers) { |
| 322 | // The LazyFunctionStep has so far only resolved by function shape, check |
| 323 | // that the runtime argument kinds agree with the specific descriptor for |
| 324 | // the provider candidates. |
| 325 | if (!ArgumentKindsMatch(provider.descriptor, input_args)) { |
| 326 | continue; |
| 327 | } |
| 328 | |
| 329 | CEL_ASSIGN_OR_RETURN(auto overload, |
| 330 | provider.provider.GetFunction(matcher, activation)); |
| 331 | if (overload.has_value()) { |
| 332 | // More than one overload matches our arguments. |
| 333 | if (result.has_value()) { |
| 334 | return absl::Status(absl::StatusCode::kInternal, |
| 335 | "Cannot resolve overloads"); |
| 336 | } |
| 337 | |
| 338 | result.emplace(overload.value()); |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | return result; |
| 343 | } |
| 344 | |
| 345 | class EagerFunctionStep : public AbstractFunctionStep { |
| 346 | public: |
no test coverage detected