MCPcopy Create free account
hub / github.com/covscript/covscript / call_rr

Method call_rr

sources/instance/statement.cpp:30–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29namespace 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 {

Callers

nothing calls this directly

Calls 12

runtime_errorClass · 0.85
poll_eventMethod · 0.80
sizeMethod · 0.80
add_var_no_returnMethod · 0.80
dataMethod · 0.80
exceptionFunction · 0.70
to_stringFunction · 0.50
runMethod · 0.45
get_line_numMethod · 0.45
whatMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected