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.
| 108 | // arguments copy. |
| 109 | // Argument and attribute spans are expected to be equal length. |
| 110 | std::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 | |
| 130 | bool IsUnknownFunctionResultError(const Value& result) { |
| 131 | if (!result->Is<cel::ErrorValue>()) { |
no test coverage detected