MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / callFunc

Method callFunc

src/script/v8/engine.cpp:249–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247 }
248
249 static void callFunc(const v8::FunctionCallbackInfo<v8::Value>& args) {
250 auto isolate = args.GetIsolate();
251 v8::HandleScope handle_scope(isolate);
252 auto data = args.Data().As<v8::External>();
253 auto& func = *reinterpret_cast<script::Function*>(data->Value());
254
255 for (int i = 0; i < args.Length(); i++) {
256 func.arguments.push_back(getValue(isolate, args[i]));
257 }
258
259 func.result.makeUndefined();
260
261 try {
262 func();
263 } catch (const ObjectDestroyedException&) {
264 std::cout << "Object Destroyed Exception" << std::endl;
265 }
266 args.GetReturnValue().Set(returnValue(isolate, func.result));
267 }
268
269 void pushFunctions(v8::Local<v8::Object>& object) {
270 auto isolate = m_engine.get<V8Engine>()->m_isolate;

Callers

nothing calls this directly

Calls 3

makeUndefinedMethod · 0.80
returnValueFunction · 0.70
ValueMethod · 0.45

Tested by

no test coverage detected