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

Function CheckForPartialUnknowns

eval/eval/function_step.cc:110–128  ·  view source on GitHub ↗

Convert partially unknown arguments to unknowns before passing to the function. TODO(issues/52): See if this can be refactored to remove the eager arguments copy. Argument and attribute spans are expected to be equal length.

Source from the content-addressed store, hash-verified

108// arguments copy.
109// Argument and attribute spans are expected to be equal length.
110std::vector<cel::Value> CheckForPartialUnknowns(
111 ExecutionFrame* frame, absl::Span<const cel::Value> args,
112 absl::Span<const AttributeTrail> attrs) {
113 std::vector<cel::Value> result;
114 result.reserve(args.size());
115 for (size_t i = 0; i < args.size(); i++) {
116 const AttributeTrail& trail = attrs.subspan(i, 1)[0];
117
118 if (frame->attribute_utility().CheckForUnknown(trail,
119 /*use_partial=*/true)) {
120 result.push_back(
121 frame->attribute_utility().CreateUnknownSet(trail.attribute()));
122 } else {
123 result.push_back(args.at(i));
124 }
125 }
126
127 return result;
128}
129
130bool IsUnknownFunctionResultError(const Value& result) {
131 if (!result->Is<cel::ErrorValue>()) {

Callers 1

DoEvaluateMethod · 0.85

Calls 5

attributeMethod · 0.80
atMethod · 0.80
sizeMethod · 0.45
CheckForUnknownMethod · 0.45
CreateUnknownSetMethod · 0.45

Tested by

no test coverage detected