| 678 | |
| 679 | template <typename T, typename X> |
| 680 | void foreach_helper(const context_t &context, const var_id &iterator, const var &obj, |
| 681 | std::deque<statement_base *> &body) |
| 682 | { |
| 683 | if (obj.const_val<T>().empty()) |
| 684 | return; |
| 685 | if (context->instance->break_block) |
| 686 | context->instance->break_block = false; |
| 687 | if (context->instance->continue_block) |
| 688 | context->instance->continue_block = false; |
| 689 | scope_guard scope(context); |
| 690 | for (const X &it : obj.const_val<T>()) { |
| 691 | current_process->poll_event(); |
| 692 | context->instance->storage.add_var_no_return(iterator, it); |
| 693 | for (auto &ptr : body) { |
| 694 | try { |
| 695 | ptr->run(); |
| 696 | } |
| 697 | catch (const cs::exception &e) { |
| 698 | throw e; |
| 699 | } |
| 700 | catch (const std::exception &e) { |
| 701 | throw exception(ptr->get_line_num(), ptr->get_file_path(), ptr->get_raw_code(), e.what()); |
| 702 | } |
| 703 | if (context->instance->return_fcall) { |
| 704 | return; |
| 705 | } |
| 706 | if (context->instance->break_block) { |
| 707 | context->instance->break_block = false; |
| 708 | return; |
| 709 | } |
| 710 | if (context->instance->continue_block) { |
| 711 | context->instance->continue_block = false; |
| 712 | break; |
| 713 | } |
| 714 | } |
| 715 | scope.clear(); |
| 716 | } |
| 717 | } |
| 718 | |
| 719 | void statement_foreach::run_impl() |
| 720 | { |
nothing calls this directly
no test coverage detected