MCPcopy Create free account
hub / github.com/GNOME/gjs / invoke_static_method

Method invoke_static_method

gi/boxed.cpp:283–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281
282template <class Base, class Prototype, class Instance>
283bool BoxedInstance<Base, Prototype, Instance>::invoke_static_method(
284 JSContext* cx, JS::HandleObject obj, JS::HandleId method_name,
285 const JS::CallArgs& args) {
286 GjsContextPrivate* gjs = GjsContextPrivate::from_cx(cx);
287 JS::RootedObject js_constructor{cx};
288
289 if (!gjs_object_require_property(
290 cx, obj, nullptr, gjs->atoms().constructor(), &js_constructor))
291 return false;
292
293 JS::RootedValue method{cx};
294 if (!gjs_object_require_property(cx, js_constructor, nullptr, method_name,
295 &method))
296 return false;
297
298 return gjs->call_function(nullptr, method, args, args.rval());
299}
300
301/**
302 * BoxedInstance::copy_boxed:

Callers

nothing calls this directly

Calls 3

call_functionMethod · 0.80
constructorMethod · 0.45

Tested by

no test coverage detected