| 28 | |
| 29 | namespace cs { |
| 30 | var function::call_rr(const function *_this, vector &args) |
| 31 | { |
| 32 | current_process->poll_event(); |
| 33 | if (args.size() != _this->mArgs.size()) |
| 34 | throw runtime_error( |
| 35 | "Wrong size of arguments. Expected " + std::to_string(_this->mArgs.size()) + ", provided " + |
| 36 | std::to_string(args.size())); |
| 37 | scope_guard scope(_this->mContext); |
| 38 | #ifdef CS_DEBUGGER |
| 39 | fcall_guard fcall(_this->mDecl); |
| 40 | if (_this->mMatch) |
| 41 | cs_debugger_func_callback(_this->mDecl, _this->mStmt); |
| 42 | #else |
| 43 | fcall_guard fcall; |
| 44 | #endif |
| 45 | for (std::size_t i = 0; i < args.size(); ++i) |
| 46 | _this->mContext->instance->storage.add_var_no_return(_this->mArgs[i].data(), args[i]); |
| 47 | for (auto &ptr : _this->mBody) { |
| 48 | try { |
| 49 | ptr->run(); |
| 50 | } |
| 51 | catch (const cs::exception &e) { |
| 52 | throw e; |
| 53 | } |
| 54 | catch (const std::exception &e) { |
| 55 | throw exception(ptr->get_line_num(), ptr->get_file_path(), ptr->get_raw_code(), e.what()); |
| 56 | } |
| 57 | if (_this->mContext->instance->return_fcall) { |
| 58 | _this->mContext->instance->return_fcall = false; |
| 59 | return fcall.get(); |
| 60 | } |
| 61 | } |
| 62 | return fcall.get(); |
| 63 | } |
| 64 | |
| 65 | var function::call_vv(const function *_this, vector &args) |
| 66 | { |
nothing calls this directly
no test coverage detected