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

Method DoEvaluate

eval/eval/function_step.cc:244–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244absl::StatusOr<Value> AbstractFunctionStep::DoEvaluate(
245 ExecutionFrame* frame) const {
246 // Create Span object that contains input arguments to the function.
247 auto input_args = frame->value_stack().GetSpan(num_arguments_);
248
249 std::vector<cel::Value> unknowns_args;
250 // Preprocess args. If an argument is partially unknown, convert it to an
251 // unknown attribute set.
252 if (frame->enable_unknowns()) {
253 auto input_attrs = frame->value_stack().GetAttributeSpan(num_arguments_);
254 unknowns_args = CheckForPartialUnknowns(frame, input_args, input_attrs);
255 input_args = absl::MakeConstSpan(unknowns_args);
256 }
257
258 // Derived class resolves to a single function overload or none.
259 CEL_ASSIGN_OR_RETURN(ResolveResult matched_function,
260 ResolveFunction(input_args, frame));
261
262 // Overload found and is allowed to consume the arguments.
263 if (matched_function.has_value() &&
264 ShouldAcceptOverload(matched_function->descriptor, input_args)) {
265 return Invoke(*matched_function, id(), input_args, *frame);
266 }
267
268 return NoOverloadResult(name_, input_args, receiver_style_, *frame);
269}
270
271absl::Status AbstractFunctionStep::Evaluate(ExecutionFrame* frame) const {
272 if (!frame->value_stack().HasEnough(num_arguments_)) {

Callers

nothing calls this directly

Calls 8

CheckForPartialUnknownsFunction · 0.85
ShouldAcceptOverloadFunction · 0.85
InvokeFunction · 0.85
NoOverloadResultFunction · 0.85
GetSpanMethod · 0.80
GetAttributeSpanMethod · 0.80
enable_unknownsMethod · 0.45
has_valueMethod · 0.45

Tested by

no test coverage detected