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

Function define_native_accessor_wrapper

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

Source from the content-addressed store, hash-verified

145}
146
147GJS_JSAPI_RETURN_CONVENTION
148static JSObject* define_native_accessor_wrapper(JSContext* cx, JSNative call,
149 unsigned nargs,
150 const char* func_name,
151 JS::HandleValue private_slot) {
152 JSFunction* func =
153 js::NewFunctionWithReserved(cx, call, nargs, 0, func_name);
154 if (!func)
155 return nullptr;
156
157 JSObject* func_obj = JS_GetFunctionObject(func);
158 js::SetFunctionNativeReserved(func_obj, DYNAMIC_PROPERTY_PRIVATE_SLOT,
159 private_slot);
160 return func_obj;
161}
162
163/**
164 * gjs_define_property_dynamic:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected