| 51 | } |
| 52 | |
| 53 | absl::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 |
nothing calls this directly
no test coverage detected