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

Function gjs_construct_object_dynamic

gjs/jsapi-dynamic-class.cpp:130–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130JSObject* gjs_construct_object_dynamic(JSContext* cx, JS::HandleObject proto,
131 const JS::HandleValueArray& args) {
132 const GjsAtoms& atoms = GjsContextPrivate::atoms(cx);
133 JS::RootedObject constructor{cx};
134
135 if (!gjs_object_require_property(cx, proto, "prototype",
136 atoms.constructor(), &constructor))
137 return nullptr;
138
139 JS::RootedValue v_constructor{cx, JS::ObjectValue(*constructor)};
140 JS::RootedObject object{cx};
141 if (!JS::Construct(cx, v_constructor, args, &object))
142 return nullptr;
143
144 return object;
145}
146
147GJS_JSAPI_RETURN_CONVENTION
148static JSObject* define_native_accessor_wrapper(JSContext* cx, JSNative call,

Callers 1

Calls 2

constructorMethod · 0.45

Tested by

no test coverage detected