| 279 | } |
| 280 | |
| 281 | absl::StatusOr<bool> ComprehensionDirectStep::Evaluate1Known( |
| 282 | ExecutionFrameBase& frame, ValueIterator* absl_nonnull range_iter, |
| 283 | ComprehensionSlots::Slot* absl_nonnull accu_slot, |
| 284 | ComprehensionSlots::Slot* absl_nonnull iter_slot, Value& result, |
| 285 | AttributeTrail& trail) const { |
| 286 | Value condition; |
| 287 | AttributeTrail condition_attr; |
| 288 | |
| 289 | while (true) { |
| 290 | CEL_ASSIGN_OR_RETURN( |
| 291 | bool ok, |
| 292 | range_iter->Next1(frame.descriptor_pool(), frame.message_factory(), |
| 293 | frame.arena(), iter_slot->mutable_value())); |
| 294 | if (!ok) { |
| 295 | break; |
| 296 | } |
| 297 | CEL_RETURN_IF_ERROR(frame.IncrementIterations()); |
| 298 | |
| 299 | // Evaluate the loop condition. |
| 300 | CEL_RETURN_IF_ERROR(condition_->Evaluate(frame, condition, condition_attr)); |
| 301 | |
| 302 | switch (condition.kind()) { |
| 303 | case ValueKind::kBool: |
| 304 | break; |
| 305 | case ValueKind::kError: |
| 306 | ABSL_FALLTHROUGH_INTENDED; |
| 307 | case ValueKind::kUnknown: |
| 308 | result = std::move(condition); |
| 309 | return true; |
| 310 | default: |
| 311 | result = |
| 312 | cel::ErrorValue(CreateNoMatchingOverloadError("<loop_condition>")); |
| 313 | return true; |
| 314 | } |
| 315 | |
| 316 | if (shortcircuiting_ && !absl::implicit_cast<bool>(condition.GetBool())) { |
| 317 | break; |
| 318 | } |
| 319 | |
| 320 | // Evaluate the loop step. |
| 321 | CEL_RETURN_IF_ERROR(loop_step_->Evaluate(frame, *accu_slot->mutable_value(), |
| 322 | *accu_slot->mutable_attribute())); |
| 323 | } |
| 324 | return false; |
| 325 | } |
| 326 | |
| 327 | absl::Status ComprehensionDirectStep::Evaluate2(ExecutionFrameBase& frame, |
| 328 | Value& result, |
nothing calls this directly
no test coverage detected