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

Function gjs_lookup_interface_constructor

gi/interface.cpp:165–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163// clang-format on
164
165bool gjs_lookup_interface_constructor(JSContext* cx, GType gtype,
166 JS::MutableHandleValue value_p) {
167 GI::Repository repo;
168 Maybe<GI::AutoRegisteredTypeInfo> interface_info{repo.find_by_gtype(gtype)};
169 if (!interface_info) {
170 gjs_throw(cx, "Cannot expose non introspectable interface %s",
171 g_type_name(gtype));
172 return false;
173 }
174
175 JSObject* constructor =
176 gjs_lookup_generic_constructor(cx, interface_info.ref());
177 if (G_UNLIKELY(!constructor))
178 return false;
179
180 value_p.setObject(*constructor);
181 return true;
182}

Callers 1

Calls 4

gjs_throwFunction · 0.85
find_by_gtypeMethod · 0.80
refMethod · 0.45

Tested by

no test coverage detected