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

Method has_instance

gi/interface.cpp:109–124  ·  view source on GitHub ↗

* InterfaceBase::has_instance: * * JSNative implementation of `[Symbol.hasInstance]()`. This method is never * called directly, but instead is called indirectly by the JS engine as part of * an `instanceof` expression. */

Source from the content-addressed store, hash-verified

107 * an `instanceof` expression.
108 */
109bool InterfaceBase::has_instance(JSContext* cx, unsigned argc, JS::Value* vp) {
110 GJS_GET_THIS(cx, argc, vp, args, interface_constructor);
111
112 JS::RootedObject interface_proto(cx);
113 const GjsAtoms& atoms = GjsContextPrivate::atoms(cx);
114 if (!gjs_object_require_property(cx, interface_constructor,
115 "interface constructor", atoms.prototype(),
116 &interface_proto))
117 return false;
118
119 InterfaceBase* priv;
120 if (!for_js_typecheck(cx, interface_proto, &priv))
121 return false;
122
123 return priv->to_prototype()->has_instance_impl(cx, args);
124}
125
126// See InterfaceBase::has_instance().
127bool InterfacePrototype::has_instance_impl(JSContext* cx,

Callers

nothing calls this directly

Calls 4

prototypeMethod · 0.80
has_instance_implMethod · 0.80
to_prototypeMethod · 0.80

Tested by

no test coverage detected